dinahosting-cli 0.1.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,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Dinacli contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,261 @@
1
+ Metadata-Version: 2.4
2
+ Name: dinahosting-cli
3
+ Version: 0.1.0
4
+ Summary: Python client for the Dinahosting API
5
+ Author: Dinacli contributors
6
+ License-Expression: MIT
7
+ Classifier: Programming Language :: Python :: 3.14
8
+ Classifier: Programming Language :: Python :: Implementation :: CPython
9
+ Classifier: Operating System :: OS Independent
10
+ Requires-Python: >=3.14
11
+ Description-Content-Type: text/markdown
12
+ License-File: LICENSE
13
+ Dynamic: license-file
14
+
15
+ <p align="center">
16
+ <img src="https://img.shields.io/badge/dinahosting--cli-Dinahosting%20API-blue?style=for-the-badge" alt="dinahosting-cli">
17
+ </p>
18
+
19
+ <h1 align="center">dinahosting-cli</h1>
20
+
21
+ <p align="center">
22
+ <strong>Python 3.14 client and command-line interface for the Dinahosting API</strong>
23
+ </p>
24
+
25
+ <p align="center">
26
+ <a href="https://pypi.org/project/dinahosting-cli/"><img src="https://img.shields.io/pypi/v/dinahosting-cli?style=flat-square&logo=pypi&logoColor=white" alt="PyPI Version"></a>
27
+ <a href="https://pypi.org/project/dinahosting-cli/"><img src="https://img.shields.io/pypi/pyversions/dinahosting-cli?style=flat-square&logo=python&logoColor=white" alt="Python Versions"></a>
28
+ <a href="https://github.com/seifreed/dinacli/blob/main/LICENSE"><img src="https://img.shields.io/badge/license-MIT-green?style=flat-square" alt="License"></a>
29
+ <a href="https://github.com/seifreed/dinacli/stargazers"><img src="https://img.shields.io/github/stars/seifreed/dinacli?style=flat-square" alt="GitHub Stars"></a>
30
+ <a href="https://github.com/seifreed/dinacli/issues"><img src="https://img.shields.io/github/issues/seifreed/dinacli?style=flat-square" alt="GitHub Issues"></a>
31
+ <a href="https://buymeacoffee.com/seifreed"><img src="https://img.shields.io/badge/Buy%20Me%20a%20Coffee-support-yellow?style=flat-square&logo=buy-me-a-coffee&logoColor=white" alt="Buy Me a Coffee"></a>
32
+ </p>
33
+
34
+ ---
35
+
36
+ ## Overview
37
+
38
+ **dinahosting-cli** is a Python library and CLI for the Dinahosting API. It exposes the 485 documented API commands, validates their documented parameters, sends form-encoded requests through HTTPS, and returns typed responses.
39
+
40
+ ### Key Features
41
+
42
+ | Feature | Description |
43
+ |---------|-------------|
44
+ | **Complete command catalogue** | Access all 485 documented Dinahosting API commands |
45
+ | **CLI + library** | Automate from `dinacli` or use `DinaClient` in Python |
46
+ | **Parameter validation** | Required and optional parameters are checked before requests are sent |
47
+ | **JSON output** | Commands, descriptions, responses, and optional errors are machine-readable |
48
+ | **Configuration sources** | Credentials and connection settings from flags, environment variables, or TOML |
49
+ | **Secure transport** | HTTPS is required for remote endpoints; HTTP is limited to loopback integration tests |
50
+ | **Typed failures** | Configuration, connection, protocol, and API errors have distinct exception types |
51
+
52
+ ### Supported Interfaces
53
+
54
+ ```text
55
+ CLI commands, describe, call
56
+ Configuration command-line flags, DINA_* environment variables, TOML
57
+ Response data JSON output and DinaResponse objects
58
+ Python access exact API names and hierarchical namespaces
59
+ ```
60
+
61
+ ---
62
+
63
+ ## Installation
64
+
65
+ ### From PyPI
66
+
67
+ After publication, install the package with:
68
+
69
+ ```bash
70
+ python -m pip install dinahosting-cli
71
+ ```
72
+
73
+ ### From Source
74
+
75
+ ```bash
76
+ git clone https://github.com/seifreed/dinacli.git
77
+ cd dinacli
78
+ python3 -m venv venv
79
+ source venv/bin/activate # Windows: venv\Scripts\activate
80
+ python -m pip install -e .
81
+ ```
82
+
83
+ Development tooling is declared in `pyproject.toml` alongside the package metadata.
84
+
85
+ ---
86
+
87
+ ## Quick Start
88
+
89
+ ```bash
90
+ # List every documented API command
91
+ dinacli commands
92
+
93
+ # Inspect parameters before executing a command
94
+ dinacli describe Domain_Zone_AddTypeA
95
+
96
+ # Execute a simulated request
97
+ dinacli --user mi_usuario --password mi_contrasena \
98
+ call Domain_Zone_AddTypeA \
99
+ --param domain=example.com \
100
+ --param hostname=www \
101
+ --param ip=192.0.2.10 \
102
+ --simulate
103
+ ```
104
+
105
+ ---
106
+
107
+ ## Usage
108
+
109
+ ### Command Line Interface
110
+
111
+ ```bash
112
+ # List commands as JSON
113
+ dinacli --output json commands
114
+
115
+ # Display required and optional parameters
116
+ dinacli describe Vps_PowerStatus_Restart
117
+
118
+ # Pass strings, numbers, booleans, arrays, or objects with --param
119
+ dinacli --user mi_usuario --password mi_contrasena \
120
+ call Domain_Zone_AddTypeA \
121
+ --param domain=example.com \
122
+ --param hostname=www \
123
+ --param ip=192.0.2.10 \
124
+ --simulate
125
+ ```
126
+
127
+ ### Commands
128
+
129
+ | Command | Description |
130
+ |---------|-------------|
131
+ | `dinacli commands` | List the 485 documented API command names |
132
+ | `dinacli describe COMANDO` | Show a command's required and optional parameters |
133
+ | `dinacli call COMANDO` | Validate and execute a documented API command |
134
+
135
+ ### Global Options
136
+
137
+ | Option | Description |
138
+ |--------|-------------|
139
+ | `--config ARCHIVO` | TOML file with a `[dina]` section |
140
+ | `--user USUARIO` | Dinahosting API user |
141
+ | `--password CLAVE` | Dinahosting API password |
142
+ | `--endpoint URL` | Override the default API endpoint |
143
+ | `--timeout SEGUNDOS` | Request timeout; defaults to 20 seconds |
144
+ | `--output json` | JSON array for `commands` and JSON errors on stderr |
145
+ | `--version` | Print the installed package version |
146
+
147
+ Global options must precede the subcommand. `call` accepts `--param NOMBRE=VALOR` repeatedly. Valid JSON values are decoded before sending; other values are sent as text. `--simulate` sends the API `SIMULATE` parameter.
148
+
149
+ ### Configuration
150
+
151
+ `DINA_USER` and `DINA_PASSWORD` are required when creating a client from the environment. The optional variables are `DINA_ENDPOINT` and `DINA_TIMEOUT`.
152
+
153
+ ```toml
154
+ [dina]
155
+ user = "mi_usuario"
156
+ password = "mi_contrasena"
157
+ endpoint = "https://dinahosting.com/special/api.php"
158
+ timeout = 20
159
+ ```
160
+
161
+ Command-line flags take precedence over `DINA_*` variables, which take precedence over TOML values. Prefer environment variables or a protected TOML file over passing a password directly on the command line.
162
+
163
+ ---
164
+
165
+ ## Python Library
166
+
167
+ ### Basic Usage
168
+
169
+ ```python
170
+ from dinacli import DinaClient
171
+
172
+ client = DinaClient.from_environment()
173
+ domains = client.call("Services_GetDomains").data
174
+ ```
175
+
176
+ ### Documented Commands
177
+
178
+ ```python
179
+ from dinacli import DinaClient
180
+
181
+ client = DinaClient("mi_usuario", "mi_contrasena")
182
+
183
+ client.api.domain.zone.add_type_a(
184
+ domain="example.com",
185
+ hostname="www",
186
+ ip="192.0.2.10",
187
+ )
188
+
189
+ client.api["Vps_PowerStatus_Restart"](serverName="vps.example.com")
190
+ ```
191
+
192
+ Every documented command validates its required and optional parameters. Successful calls return `DinaResponse`; non-success API codes raise `DinaApiError`.
193
+
194
+ ---
195
+
196
+ ## Requirements
197
+
198
+ - Python 3.14+
199
+ - No runtime dependencies
200
+
201
+ See [pyproject.toml](pyproject.toml) for package metadata and development tooling.
202
+
203
+ ---
204
+
205
+ ## Releases
206
+
207
+ CI runs the full quality and security gate on the latest Linux, Windows, and
208
+ macOS runners using Python 3.14. Push a version tag that matches the package
209
+ version to publish a release:
210
+
211
+ ```bash
212
+ git tag v0.1.0
213
+ git push origin v0.1.0
214
+ ```
215
+
216
+ PyPI publishing uses GitHub Actions OIDC Trusted Publishing and does not use a
217
+ stored PyPI token. Before the first release, register a pending publisher in
218
+ PyPI with the following values:
219
+
220
+ ```text
221
+ Project: dinahosting-cli
222
+ Owner: seifreed
223
+ Repository: dinacli
224
+ Workflow: release.yml
225
+ Environment: pypi
226
+ ```
227
+
228
+ Configure the optional `pypi` GitHub environment with required reviewers when
229
+ manual release approval is desired.
230
+
231
+ ---
232
+
233
+ ## Contributing
234
+
235
+ 1. Fork the repository.
236
+ 2. Create a feature branch.
237
+ 3. Run the quality and security gates from `AGENTS.md`.
238
+ 4. Commit and push the change.
239
+ 5. Open a pull request.
240
+
241
+ ---
242
+
243
+ ## Support the Project
244
+
245
+ <a href="https://buymeacoffee.com/seifreed" target="_blank">
246
+ <img src="https://cdn.buymeacoffee.com/buttons/v2/default-yellow.png" alt="Buy Me A Coffee" height="50">
247
+ </a>
248
+
249
+ ---
250
+
251
+ ## License
252
+
253
+ This project is licensed under the [MIT License](LICENSE).
254
+
255
+ **Repository:** [github.com/seifreed/dinacli](https://github.com/seifreed/dinacli)
256
+
257
+ ---
258
+
259
+ <p align="center">
260
+ <sub>Built for reliable Dinahosting API automation</sub>
261
+ </p>
@@ -0,0 +1,247 @@
1
+ <p align="center">
2
+ <img src="https://img.shields.io/badge/dinahosting--cli-Dinahosting%20API-blue?style=for-the-badge" alt="dinahosting-cli">
3
+ </p>
4
+
5
+ <h1 align="center">dinahosting-cli</h1>
6
+
7
+ <p align="center">
8
+ <strong>Python 3.14 client and command-line interface for the Dinahosting API</strong>
9
+ </p>
10
+
11
+ <p align="center">
12
+ <a href="https://pypi.org/project/dinahosting-cli/"><img src="https://img.shields.io/pypi/v/dinahosting-cli?style=flat-square&logo=pypi&logoColor=white" alt="PyPI Version"></a>
13
+ <a href="https://pypi.org/project/dinahosting-cli/"><img src="https://img.shields.io/pypi/pyversions/dinahosting-cli?style=flat-square&logo=python&logoColor=white" alt="Python Versions"></a>
14
+ <a href="https://github.com/seifreed/dinacli/blob/main/LICENSE"><img src="https://img.shields.io/badge/license-MIT-green?style=flat-square" alt="License"></a>
15
+ <a href="https://github.com/seifreed/dinacli/stargazers"><img src="https://img.shields.io/github/stars/seifreed/dinacli?style=flat-square" alt="GitHub Stars"></a>
16
+ <a href="https://github.com/seifreed/dinacli/issues"><img src="https://img.shields.io/github/issues/seifreed/dinacli?style=flat-square" alt="GitHub Issues"></a>
17
+ <a href="https://buymeacoffee.com/seifreed"><img src="https://img.shields.io/badge/Buy%20Me%20a%20Coffee-support-yellow?style=flat-square&logo=buy-me-a-coffee&logoColor=white" alt="Buy Me a Coffee"></a>
18
+ </p>
19
+
20
+ ---
21
+
22
+ ## Overview
23
+
24
+ **dinahosting-cli** is a Python library and CLI for the Dinahosting API. It exposes the 485 documented API commands, validates their documented parameters, sends form-encoded requests through HTTPS, and returns typed responses.
25
+
26
+ ### Key Features
27
+
28
+ | Feature | Description |
29
+ |---------|-------------|
30
+ | **Complete command catalogue** | Access all 485 documented Dinahosting API commands |
31
+ | **CLI + library** | Automate from `dinacli` or use `DinaClient` in Python |
32
+ | **Parameter validation** | Required and optional parameters are checked before requests are sent |
33
+ | **JSON output** | Commands, descriptions, responses, and optional errors are machine-readable |
34
+ | **Configuration sources** | Credentials and connection settings from flags, environment variables, or TOML |
35
+ | **Secure transport** | HTTPS is required for remote endpoints; HTTP is limited to loopback integration tests |
36
+ | **Typed failures** | Configuration, connection, protocol, and API errors have distinct exception types |
37
+
38
+ ### Supported Interfaces
39
+
40
+ ```text
41
+ CLI commands, describe, call
42
+ Configuration command-line flags, DINA_* environment variables, TOML
43
+ Response data JSON output and DinaResponse objects
44
+ Python access exact API names and hierarchical namespaces
45
+ ```
46
+
47
+ ---
48
+
49
+ ## Installation
50
+
51
+ ### From PyPI
52
+
53
+ After publication, install the package with:
54
+
55
+ ```bash
56
+ python -m pip install dinahosting-cli
57
+ ```
58
+
59
+ ### From Source
60
+
61
+ ```bash
62
+ git clone https://github.com/seifreed/dinacli.git
63
+ cd dinacli
64
+ python3 -m venv venv
65
+ source venv/bin/activate # Windows: venv\Scripts\activate
66
+ python -m pip install -e .
67
+ ```
68
+
69
+ Development tooling is declared in `pyproject.toml` alongside the package metadata.
70
+
71
+ ---
72
+
73
+ ## Quick Start
74
+
75
+ ```bash
76
+ # List every documented API command
77
+ dinacli commands
78
+
79
+ # Inspect parameters before executing a command
80
+ dinacli describe Domain_Zone_AddTypeA
81
+
82
+ # Execute a simulated request
83
+ dinacli --user mi_usuario --password mi_contrasena \
84
+ call Domain_Zone_AddTypeA \
85
+ --param domain=example.com \
86
+ --param hostname=www \
87
+ --param ip=192.0.2.10 \
88
+ --simulate
89
+ ```
90
+
91
+ ---
92
+
93
+ ## Usage
94
+
95
+ ### Command Line Interface
96
+
97
+ ```bash
98
+ # List commands as JSON
99
+ dinacli --output json commands
100
+
101
+ # Display required and optional parameters
102
+ dinacli describe Vps_PowerStatus_Restart
103
+
104
+ # Pass strings, numbers, booleans, arrays, or objects with --param
105
+ dinacli --user mi_usuario --password mi_contrasena \
106
+ call Domain_Zone_AddTypeA \
107
+ --param domain=example.com \
108
+ --param hostname=www \
109
+ --param ip=192.0.2.10 \
110
+ --simulate
111
+ ```
112
+
113
+ ### Commands
114
+
115
+ | Command | Description |
116
+ |---------|-------------|
117
+ | `dinacli commands` | List the 485 documented API command names |
118
+ | `dinacli describe COMANDO` | Show a command's required and optional parameters |
119
+ | `dinacli call COMANDO` | Validate and execute a documented API command |
120
+
121
+ ### Global Options
122
+
123
+ | Option | Description |
124
+ |--------|-------------|
125
+ | `--config ARCHIVO` | TOML file with a `[dina]` section |
126
+ | `--user USUARIO` | Dinahosting API user |
127
+ | `--password CLAVE` | Dinahosting API password |
128
+ | `--endpoint URL` | Override the default API endpoint |
129
+ | `--timeout SEGUNDOS` | Request timeout; defaults to 20 seconds |
130
+ | `--output json` | JSON array for `commands` and JSON errors on stderr |
131
+ | `--version` | Print the installed package version |
132
+
133
+ Global options must precede the subcommand. `call` accepts `--param NOMBRE=VALOR` repeatedly. Valid JSON values are decoded before sending; other values are sent as text. `--simulate` sends the API `SIMULATE` parameter.
134
+
135
+ ### Configuration
136
+
137
+ `DINA_USER` and `DINA_PASSWORD` are required when creating a client from the environment. The optional variables are `DINA_ENDPOINT` and `DINA_TIMEOUT`.
138
+
139
+ ```toml
140
+ [dina]
141
+ user = "mi_usuario"
142
+ password = "mi_contrasena"
143
+ endpoint = "https://dinahosting.com/special/api.php"
144
+ timeout = 20
145
+ ```
146
+
147
+ Command-line flags take precedence over `DINA_*` variables, which take precedence over TOML values. Prefer environment variables or a protected TOML file over passing a password directly on the command line.
148
+
149
+ ---
150
+
151
+ ## Python Library
152
+
153
+ ### Basic Usage
154
+
155
+ ```python
156
+ from dinacli import DinaClient
157
+
158
+ client = DinaClient.from_environment()
159
+ domains = client.call("Services_GetDomains").data
160
+ ```
161
+
162
+ ### Documented Commands
163
+
164
+ ```python
165
+ from dinacli import DinaClient
166
+
167
+ client = DinaClient("mi_usuario", "mi_contrasena")
168
+
169
+ client.api.domain.zone.add_type_a(
170
+ domain="example.com",
171
+ hostname="www",
172
+ ip="192.0.2.10",
173
+ )
174
+
175
+ client.api["Vps_PowerStatus_Restart"](serverName="vps.example.com")
176
+ ```
177
+
178
+ Every documented command validates its required and optional parameters. Successful calls return `DinaResponse`; non-success API codes raise `DinaApiError`.
179
+
180
+ ---
181
+
182
+ ## Requirements
183
+
184
+ - Python 3.14+
185
+ - No runtime dependencies
186
+
187
+ See [pyproject.toml](pyproject.toml) for package metadata and development tooling.
188
+
189
+ ---
190
+
191
+ ## Releases
192
+
193
+ CI runs the full quality and security gate on the latest Linux, Windows, and
194
+ macOS runners using Python 3.14. Push a version tag that matches the package
195
+ version to publish a release:
196
+
197
+ ```bash
198
+ git tag v0.1.0
199
+ git push origin v0.1.0
200
+ ```
201
+
202
+ PyPI publishing uses GitHub Actions OIDC Trusted Publishing and does not use a
203
+ stored PyPI token. Before the first release, register a pending publisher in
204
+ PyPI with the following values:
205
+
206
+ ```text
207
+ Project: dinahosting-cli
208
+ Owner: seifreed
209
+ Repository: dinacli
210
+ Workflow: release.yml
211
+ Environment: pypi
212
+ ```
213
+
214
+ Configure the optional `pypi` GitHub environment with required reviewers when
215
+ manual release approval is desired.
216
+
217
+ ---
218
+
219
+ ## Contributing
220
+
221
+ 1. Fork the repository.
222
+ 2. Create a feature branch.
223
+ 3. Run the quality and security gates from `AGENTS.md`.
224
+ 4. Commit and push the change.
225
+ 5. Open a pull request.
226
+
227
+ ---
228
+
229
+ ## Support the Project
230
+
231
+ <a href="https://buymeacoffee.com/seifreed" target="_blank">
232
+ <img src="https://cdn.buymeacoffee.com/buttons/v2/default-yellow.png" alt="Buy Me A Coffee" height="50">
233
+ </a>
234
+
235
+ ---
236
+
237
+ ## License
238
+
239
+ This project is licensed under the [MIT License](LICENSE).
240
+
241
+ **Repository:** [github.com/seifreed/dinacli](https://github.com/seifreed/dinacli)
242
+
243
+ ---
244
+
245
+ <p align="center">
246
+ <sub>Built for reliable Dinahosting API automation</sub>
247
+ </p>
@@ -0,0 +1,57 @@
1
+ [build-system]
2
+ requires = ["setuptools>=80"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "dinahosting-cli"
7
+ version = "0.1.0"
8
+ description = "Python client for the Dinahosting API"
9
+ readme = "README.md"
10
+ requires-python = ">=3.14"
11
+ license = "MIT"
12
+ authors = [{ name = "Dinacli contributors" }]
13
+ classifiers = [
14
+ "Programming Language :: Python :: 3.14",
15
+ "Programming Language :: Python :: Implementation :: CPython",
16
+ "Operating System :: OS Independent",
17
+ ]
18
+
19
+ [project.scripts]
20
+ dinacli = "dinacli.cli:main"
21
+
22
+ [dependency-groups]
23
+ dev = [
24
+ "bandit>=1.8.0",
25
+ "black>=26.0.0",
26
+ "build>=1.3.0",
27
+ "mypy>=1.19.0",
28
+ "pip-audit>=2.10.0",
29
+ "pytest>=9.0.0",
30
+ "pytest-cov>=7.0.0",
31
+ "ruff>=0.14.0",
32
+ "twine>=6.2.0",
33
+ ]
34
+
35
+ [tool.setuptools.packages.find]
36
+ where = ["src"]
37
+
38
+ [tool.pytest.ini_options]
39
+ addopts = "--cov=dinacli --cov-branch --cov-fail-under=100"
40
+ testpaths = ["tests"]
41
+
42
+ [tool.coverage.run]
43
+ branch = true
44
+ source = ["dinacli"]
45
+
46
+ [tool.coverage.report]
47
+ show_missing = true
48
+
49
+ [tool.mypy]
50
+ strict = true
51
+ packages = ["dinacli"]
52
+
53
+ [tool.ruff]
54
+ target-version = "py314"
55
+
56
+ [tool.black]
57
+ target-version = ["py314"]
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,27 @@
1
+ """Python client for the Dinahosting API."""
2
+
3
+ from .bootstrap import DinaClient
4
+ from .commands import COMMANDS
5
+ from .models import (
6
+ CommandSpec,
7
+ DinaApiError,
8
+ DinaConfigurationError,
9
+ DinaConnectionError,
10
+ DinaError,
11
+ DinaProtocolError,
12
+ DinaResponse,
13
+ )
14
+ from .settings import DEFAULT_ENDPOINT
15
+
16
+ __all__ = [
17
+ "COMMANDS",
18
+ "DEFAULT_ENDPOINT",
19
+ "CommandSpec",
20
+ "DinaApiError",
21
+ "DinaClient",
22
+ "DinaConfigurationError",
23
+ "DinaConnectionError",
24
+ "DinaError",
25
+ "DinaProtocolError",
26
+ "DinaResponse",
27
+ ]