pindo-cli 0.2.0__tar.gz → 1.2.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,222 @@
1
+ Metadata-Version: 2.4
2
+ Name: pindo-cli
3
+ Version: 1.2.0
4
+ Summary: Command-line interface for the Pindo SMS API: log in, send test messages, manage your account and pull reports.
5
+ License-Expression: MIT
6
+ License-File: LICENSE
7
+ Keywords: pindo,sms,cli,reporting,api
8
+ Author: Team Pindo
9
+ Author-email: team@pindo.io
10
+ Requires-Python: >=3.10
11
+ Classifier: Development Status :: 5 - Production/Stable
12
+ Classifier: Environment :: Console
13
+ Classifier: Intended Audience :: Developers
14
+ Classifier: Operating System :: MacOS
15
+ Classifier: Operating System :: Microsoft :: Windows
16
+ Classifier: Operating System :: POSIX :: Linux
17
+ Classifier: Programming Language :: Python :: 3
18
+ Classifier: Programming Language :: Python :: 3 :: Only
19
+ Classifier: Programming Language :: Python :: 3.10
20
+ Classifier: Programming Language :: Python :: 3.11
21
+ Classifier: Programming Language :: Python :: 3.12
22
+ Classifier: Programming Language :: Python :: 3.13
23
+ Classifier: Programming Language :: Python :: 3.14
24
+ Classifier: Topic :: Communications :: Telephony
25
+ Classifier: Typing :: Typed
26
+ Requires-Dist: click (>=8.1.8,<9)
27
+ Requires-Dist: requests (>=2.33.0,<3)
28
+ Requires-Dist: rich (>=13.9,<16)
29
+ Requires-Dist: tomlkit (>=0.13,<1)
30
+ Requires-Dist: tzdata (>=2024.1) ; sys_platform == "win32"
31
+ Requires-Dist: urllib3 (>=2.8.0,<3)
32
+ Project-URL: Changelog, https://github.com/pindoio/pindo-cli/blob/master/CHANGELOG.md
33
+ Project-URL: Documentation, https://github.com/pindoio/pindo-cli#readme
34
+ Project-URL: Homepage, https://www.pindo.io/
35
+ Project-URL: Issues, https://github.com/pindoio/pindo-cli/issues
36
+ Project-URL: Repository, https://github.com/pindoio/pindo-cli
37
+ Description-Content-Type: text/markdown
38
+
39
+ # pindo-cli
40
+
41
+ [![Tests](https://github.com/pindoio/pindo-cli/actions/workflows/ci.yaml/badge.svg)](https://github.com/pindoio/pindo-cli/actions/workflows/ci.yaml)
42
+ [![PyPI](https://img.shields.io/pypi/v/pindo-cli.svg)](https://pypi.org/project/pindo-cli/)
43
+ [![Python versions](https://img.shields.io/pypi/pyversions/pindo-cli.svg)](https://pypi.org/project/pindo-cli/)
44
+ [![License: MIT](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE)
45
+
46
+ The official command-line interface for [Pindo](https://www.pindo.io/), the SMS
47
+ platform. Log in once, then send test messages, check your balance, manage
48
+ your organization and pull reports from your terminal or from scripts.
49
+
50
+ - [Installation](#installation)
51
+ - [Quick start](#quick-start)
52
+ - [Commands](#commands)
53
+ - [Authentication and configuration](#authentication-and-configuration)
54
+ - [Reports](#reports)
55
+ - [Using the CLI in scripts](#using-the-cli-in-scripts)
56
+ - [Using the API directly](#using-the-api-directly)
57
+ - [Development](#development)
58
+
59
+ ## Installation
60
+
61
+ Requires Python 3.10 or newer.
62
+
63
+ The recommended way is [pipx](https://pipx.pypa.io/) (or
64
+ [uv](https://docs.astral.sh/uv/)), which installs the `pindo` command in its
65
+ own isolated environment:
66
+
67
+ ```bash
68
+ pipx install pindo-cli
69
+ ```
70
+
71
+ ```bash
72
+ uv tool install pindo-cli
73
+ ```
74
+
75
+ Plain pip works too:
76
+
77
+ ```bash
78
+ python -m pip install --upgrade pindo-cli
79
+ ```
80
+
81
+ Check it worked:
82
+
83
+ ```bash
84
+ pindo --version
85
+ ```
86
+
87
+ ## Quick start
88
+
89
+ ```bash
90
+ pindo register # create an account (skip if you have one)
91
+ pindo login # saves your API token to ~/.pindo/config.toml
92
+ pindo balance # USD 71421.953
93
+ pindo sms --to +250781234567 --text "Hello from Pindo" --sender Pindo
94
+ ```
95
+
96
+ Every command prompts for anything you leave out, and `pindo <command> --help`
97
+ (or `-h`) lists its options.
98
+
99
+ ## Commands
100
+
101
+ | Command | What it does |
102
+ |---|---|
103
+ | `pindo login` | Log in and save your API token for later commands |
104
+ | `pindo logout` | Delete the saved token |
105
+ | `pindo token` | Print a new API token without saving it |
106
+ | `pindo refresh-token` | Request a fresh token and update the saved one |
107
+ | `pindo register` | Create a new Pindo account |
108
+ | `pindo forgot-password` | Email yourself a password-recovery token |
109
+ | `pindo recover-password` | Set a new password with that recovery token |
110
+ | `pindo sms` | Send a test SMS |
111
+ | `pindo balance` | Show your account balance |
112
+ | `pindo org` | Update your organization's name, delivery-report webhook and retry count |
113
+ | `pindo config show` | Show the active base URL, user and (masked) token, and where the token came from |
114
+ | `pindo config path` | Print the config file location |
115
+ | `pindo report ...` | Reporting commands (see [Reports](#reports)) |
116
+
117
+ Global options go **before** the command:
118
+
119
+ | Option | Meaning |
120
+ |---|---|
121
+ | `--debug` | Log every API request and response to stderr. Passwords and tokens are redacted. |
122
+ | `--base-url URL` | Talk to another API environment, e.g. staging |
123
+ | `-v`, `--version` | Show the version |
124
+ | `-h`, `--help` | Show help |
125
+
126
+ ```bash
127
+ pindo --debug balance
128
+ ```
129
+
130
+ Phone numbers must be in international format with the country code
131
+ (`+250781234567`). Spaces, dashes and brackets are stripped, and a missing
132
+ leading `+` is added.
133
+
134
+ ## Authentication and configuration
135
+
136
+ `pindo login` stores your token in `~/.pindo/config.toml`. The file and its
137
+ folder can only be read by your user account. Every command that needs a token
138
+ looks for one in this order:
139
+
140
+ 1. `--token` / `-t` on the command line
141
+ 2. the `PINDO_TOKEN` environment variable (handy for CI and cron jobs)
142
+ 3. the config file written by `pindo login`
143
+
144
+ | Environment variable | Purpose |
145
+ |---|---|
146
+ | `PINDO_TOKEN` | API token to use instead of the saved one |
147
+ | `PINDO_BASE_URL` | API base URL (default `https://api.pindo.io`) |
148
+ | `PINDO_CONFIG` | Use a different config file |
149
+
150
+ Run `pindo config show` to see which token is in use and where it came from.
151
+
152
+ ## Reports
153
+
154
+ Reporting commands live under `pindo report` and all share these options:
155
+
156
+ | Option | Meaning |
157
+ |---|---|
158
+ | `--from DATE` / `--to DATE` | Date range. Accepts `2026-10-01`, `today`, `yesterday` or `30d`. Default: last 7 days. |
159
+ | `--page N` / `--per-page N` | Pagination (default page 1, 50 rows) |
160
+ | `--all` | Fetch every page |
161
+ | `-o`, `--output table\|csv\|json` | Output format (default `table`) |
162
+ | `-f`, `--file PATH` | Write to a file instead of the terminal |
163
+ | `--tz ZONE` | Timezone for dates, e.g. `Africa/Kigali` or `UTC` (default: your local zone) |
164
+
165
+ Run `pindo report --help` to see the available reports.
166
+
167
+ ## Using the CLI in scripts
168
+
169
+ Errors are printed to stderr as a single `Error: ...` line, and the exit code
170
+ tells you what happened:
171
+
172
+ | Exit code | Meaning |
173
+ |---|---|
174
+ | `0` | Success |
175
+ | `1` | The API or the network returned an error (bad token, unknown email, server down, ...) |
176
+ | `2` | Invalid usage, e.g. a missing option or a malformed phone number |
177
+
178
+ ```console
179
+ $ pindo balance --token wrong
180
+ Error: Unauthorized. Your token is invalid or expired; run `pindo login`. (HTTP 401)
181
+ $ echo $?
182
+ 1
183
+ ```
184
+
185
+ Read-only requests are retried automatically, with backoff, when the server
186
+ is temporarily unavailable (HTTP 429/502/503/504). Requests that send messages
187
+ or change data are never retried, so an SMS is never sent twice.
188
+
189
+ ## Using the API directly
190
+
191
+ The CLI is a thin client for the Pindo REST API. Examples for sending SMS
192
+ (single and bulk), inbound messages, delivery-report webhooks and PindoVerify
193
+ in cURL, Python, Node.js, PHP, Ruby, Go, Java and C# are in
194
+ [docs/api.md](docs/api.md).
195
+
196
+ ## Development
197
+
198
+ You need [Poetry](https://python-poetry.org/) 2.x.
199
+
200
+ ```bash
201
+ git clone https://github.com/pindoio/pindo-cli.git
202
+ cd pindo-cli
203
+ poetry install
204
+ poetry run pre-commit install # optional: lint and format on every commit
205
+ ```
206
+
207
+ | Task | Command |
208
+ |---|---|
209
+ | Run the tests (all HTTP is mocked) | `poetry run pytest --cov` |
210
+ | Also run tests against the live API | `poetry run pytest --run-live` |
211
+ | Lint | `poetry run ruff check .` |
212
+ | Format | `poetry run ruff format .` |
213
+ | Type-check | `poetry run mypy` |
214
+ | Run the CLI from source | `poetry run pindo --help` |
215
+
216
+ See [CONTRIBUTING.md](CONTRIBUTING.md) for how the code is laid out and how
217
+ releases work. To report a security issue, see [SECURITY.md](SECURITY.md).
218
+
219
+ ## License
220
+
221
+ [MIT](LICENSE)
222
+
@@ -0,0 +1,183 @@
1
+ # pindo-cli
2
+
3
+ [![Tests](https://github.com/pindoio/pindo-cli/actions/workflows/ci.yaml/badge.svg)](https://github.com/pindoio/pindo-cli/actions/workflows/ci.yaml)
4
+ [![PyPI](https://img.shields.io/pypi/v/pindo-cli.svg)](https://pypi.org/project/pindo-cli/)
5
+ [![Python versions](https://img.shields.io/pypi/pyversions/pindo-cli.svg)](https://pypi.org/project/pindo-cli/)
6
+ [![License: MIT](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE)
7
+
8
+ The official command-line interface for [Pindo](https://www.pindo.io/), the SMS
9
+ platform. Log in once, then send test messages, check your balance, manage
10
+ your organization and pull reports from your terminal or from scripts.
11
+
12
+ - [Installation](#installation)
13
+ - [Quick start](#quick-start)
14
+ - [Commands](#commands)
15
+ - [Authentication and configuration](#authentication-and-configuration)
16
+ - [Reports](#reports)
17
+ - [Using the CLI in scripts](#using-the-cli-in-scripts)
18
+ - [Using the API directly](#using-the-api-directly)
19
+ - [Development](#development)
20
+
21
+ ## Installation
22
+
23
+ Requires Python 3.10 or newer.
24
+
25
+ The recommended way is [pipx](https://pipx.pypa.io/) (or
26
+ [uv](https://docs.astral.sh/uv/)), which installs the `pindo` command in its
27
+ own isolated environment:
28
+
29
+ ```bash
30
+ pipx install pindo-cli
31
+ ```
32
+
33
+ ```bash
34
+ uv tool install pindo-cli
35
+ ```
36
+
37
+ Plain pip works too:
38
+
39
+ ```bash
40
+ python -m pip install --upgrade pindo-cli
41
+ ```
42
+
43
+ Check it worked:
44
+
45
+ ```bash
46
+ pindo --version
47
+ ```
48
+
49
+ ## Quick start
50
+
51
+ ```bash
52
+ pindo register # create an account (skip if you have one)
53
+ pindo login # saves your API token to ~/.pindo/config.toml
54
+ pindo balance # USD 71421.953
55
+ pindo sms --to +250781234567 --text "Hello from Pindo" --sender Pindo
56
+ ```
57
+
58
+ Every command prompts for anything you leave out, and `pindo <command> --help`
59
+ (or `-h`) lists its options.
60
+
61
+ ## Commands
62
+
63
+ | Command | What it does |
64
+ |---|---|
65
+ | `pindo login` | Log in and save your API token for later commands |
66
+ | `pindo logout` | Delete the saved token |
67
+ | `pindo token` | Print a new API token without saving it |
68
+ | `pindo refresh-token` | Request a fresh token and update the saved one |
69
+ | `pindo register` | Create a new Pindo account |
70
+ | `pindo forgot-password` | Email yourself a password-recovery token |
71
+ | `pindo recover-password` | Set a new password with that recovery token |
72
+ | `pindo sms` | Send a test SMS |
73
+ | `pindo balance` | Show your account balance |
74
+ | `pindo org` | Update your organization's name, delivery-report webhook and retry count |
75
+ | `pindo config show` | Show the active base URL, user and (masked) token, and where the token came from |
76
+ | `pindo config path` | Print the config file location |
77
+ | `pindo report ...` | Reporting commands (see [Reports](#reports)) |
78
+
79
+ Global options go **before** the command:
80
+
81
+ | Option | Meaning |
82
+ |---|---|
83
+ | `--debug` | Log every API request and response to stderr. Passwords and tokens are redacted. |
84
+ | `--base-url URL` | Talk to another API environment, e.g. staging |
85
+ | `-v`, `--version` | Show the version |
86
+ | `-h`, `--help` | Show help |
87
+
88
+ ```bash
89
+ pindo --debug balance
90
+ ```
91
+
92
+ Phone numbers must be in international format with the country code
93
+ (`+250781234567`). Spaces, dashes and brackets are stripped, and a missing
94
+ leading `+` is added.
95
+
96
+ ## Authentication and configuration
97
+
98
+ `pindo login` stores your token in `~/.pindo/config.toml`. The file and its
99
+ folder can only be read by your user account. Every command that needs a token
100
+ looks for one in this order:
101
+
102
+ 1. `--token` / `-t` on the command line
103
+ 2. the `PINDO_TOKEN` environment variable (handy for CI and cron jobs)
104
+ 3. the config file written by `pindo login`
105
+
106
+ | Environment variable | Purpose |
107
+ |---|---|
108
+ | `PINDO_TOKEN` | API token to use instead of the saved one |
109
+ | `PINDO_BASE_URL` | API base URL (default `https://api.pindo.io`) |
110
+ | `PINDO_CONFIG` | Use a different config file |
111
+
112
+ Run `pindo config show` to see which token is in use and where it came from.
113
+
114
+ ## Reports
115
+
116
+ Reporting commands live under `pindo report` and all share these options:
117
+
118
+ | Option | Meaning |
119
+ |---|---|
120
+ | `--from DATE` / `--to DATE` | Date range. Accepts `2026-10-01`, `today`, `yesterday` or `30d`. Default: last 7 days. |
121
+ | `--page N` / `--per-page N` | Pagination (default page 1, 50 rows) |
122
+ | `--all` | Fetch every page |
123
+ | `-o`, `--output table\|csv\|json` | Output format (default `table`) |
124
+ | `-f`, `--file PATH` | Write to a file instead of the terminal |
125
+ | `--tz ZONE` | Timezone for dates, e.g. `Africa/Kigali` or `UTC` (default: your local zone) |
126
+
127
+ Run `pindo report --help` to see the available reports.
128
+
129
+ ## Using the CLI in scripts
130
+
131
+ Errors are printed to stderr as a single `Error: ...` line, and the exit code
132
+ tells you what happened:
133
+
134
+ | Exit code | Meaning |
135
+ |---|---|
136
+ | `0` | Success |
137
+ | `1` | The API or the network returned an error (bad token, unknown email, server down, ...) |
138
+ | `2` | Invalid usage, e.g. a missing option or a malformed phone number |
139
+
140
+ ```console
141
+ $ pindo balance --token wrong
142
+ Error: Unauthorized. Your token is invalid or expired; run `pindo login`. (HTTP 401)
143
+ $ echo $?
144
+ 1
145
+ ```
146
+
147
+ Read-only requests are retried automatically, with backoff, when the server
148
+ is temporarily unavailable (HTTP 429/502/503/504). Requests that send messages
149
+ or change data are never retried, so an SMS is never sent twice.
150
+
151
+ ## Using the API directly
152
+
153
+ The CLI is a thin client for the Pindo REST API. Examples for sending SMS
154
+ (single and bulk), inbound messages, delivery-report webhooks and PindoVerify
155
+ in cURL, Python, Node.js, PHP, Ruby, Go, Java and C# are in
156
+ [docs/api.md](docs/api.md).
157
+
158
+ ## Development
159
+
160
+ You need [Poetry](https://python-poetry.org/) 2.x.
161
+
162
+ ```bash
163
+ git clone https://github.com/pindoio/pindo-cli.git
164
+ cd pindo-cli
165
+ poetry install
166
+ poetry run pre-commit install # optional: lint and format on every commit
167
+ ```
168
+
169
+ | Task | Command |
170
+ |---|---|
171
+ | Run the tests (all HTTP is mocked) | `poetry run pytest --cov` |
172
+ | Also run tests against the live API | `poetry run pytest --run-live` |
173
+ | Lint | `poetry run ruff check .` |
174
+ | Format | `poetry run ruff format .` |
175
+ | Type-check | `poetry run mypy` |
176
+ | Run the CLI from source | `poetry run pindo --help` |
177
+
178
+ See [CONTRIBUTING.md](CONTRIBUTING.md) for how the code is laid out and how
179
+ releases work. To report a security issue, see [SECURITY.md](SECURITY.md).
180
+
181
+ ## License
182
+
183
+ [MIT](LICENSE)
@@ -0,0 +1,10 @@
1
+ """Command-line interface for the Pindo SMS API."""
2
+
3
+ from importlib.metadata import PackageNotFoundError, version
4
+
5
+ try:
6
+ __version__ = version('pindo-cli')
7
+ except PackageNotFoundError: # pragma: no cover - running from a source tree without install
8
+ __version__ = '0.0.0+unknown'
9
+
10
+ __all__ = ['__version__']
@@ -0,0 +1,6 @@
1
+ """Allow ``python -m pindo_cli``."""
2
+
3
+ from pindo_cli.cli import cli
4
+
5
+ if __name__ == '__main__': # pragma: no cover
6
+ cli(prog_name='pindo')