zosmfrestapi 0.2.0__tar.gz → 0.3.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.
Files changed (40) hide show
  1. zosmfrestapi-0.3.0/PKG-INFO +218 -0
  2. zosmfrestapi-0.3.0/README.md +191 -0
  3. {zosmfrestapi-0.2.0 → zosmfrestapi-0.3.0}/pyproject.toml +112 -97
  4. zosmfrestapi-0.3.0/zosmfrestapi/__init__.py +11 -0
  5. zosmfrestapi-0.2.0/zosmfrestapi/utils.py → zosmfrestapi-0.3.0/zosmfrestapi/_utils.py +1 -1
  6. zosmfrestapi-0.3.0/zosmfrestapi/exceptions/__init__.py +21 -0
  7. {zosmfrestapi-0.2.0 → zosmfrestapi-0.3.0}/zosmfrestapi/exceptions/authentication.py +1 -1
  8. {zosmfrestapi-0.2.0 → zosmfrestapi-0.3.0}/zosmfrestapi/exceptions/dataset.py +1 -1
  9. {zosmfrestapi-0.2.0 → zosmfrestapi-0.3.0}/zosmfrestapi/exceptions/software.py +1 -1
  10. {zosmfrestapi-0.2.0 → zosmfrestapi-0.3.0}/zosmfrestapi/exceptions/workflow.py +1 -1
  11. zosmfrestapi-0.3.0/zosmfrestapi/models/__init__.py +35 -0
  12. {zosmfrestapi-0.2.0 → zosmfrestapi-0.3.0}/zosmfrestapi/services/__init__.py +10 -5
  13. {zosmfrestapi-0.2.0 → zosmfrestapi-0.3.0}/zosmfrestapi/services/software.py +6 -7
  14. {zosmfrestapi-0.2.0 → zosmfrestapi-0.3.0}/zosmfrestapi/services/software_updates.py +10 -11
  15. {zosmfrestapi-0.2.0 → zosmfrestapi-0.3.0}/zosmfrestapi/services/topology.py +3 -3
  16. {zosmfrestapi-0.2.0 → zosmfrestapi-0.3.0}/zosmfrestapi/services/workflow.py +8 -10
  17. {zosmfrestapi-0.2.0 → zosmfrestapi-0.3.0}/zosmfrestapi/zcrypto_client.py +2 -1
  18. zosmfrestapi-0.2.0/PKG-INFO +0 -172
  19. zosmfrestapi-0.2.0/README.md +0 -146
  20. zosmfrestapi-0.2.0/zosmfrestapi/__init__.py +0 -93
  21. zosmfrestapi-0.2.0/zosmfrestapi/models/__init__.py +0 -0
  22. {zosmfrestapi-0.2.0 → zosmfrestapi-0.3.0}/LICENSE +0 -0
  23. {zosmfrestapi-0.2.0 → zosmfrestapi-0.3.0}/zosmfrestapi/client.py +0 -0
  24. /zosmfrestapi-0.2.0/zosmfrestapi/exceptions/__init__.py → /zosmfrestapi-0.3.0/zosmfrestapi/exceptions/commons.py +0 -0
  25. {zosmfrestapi-0.2.0 → zosmfrestapi-0.3.0}/zosmfrestapi/models/authentication.py +0 -0
  26. {zosmfrestapi-0.2.0 → zosmfrestapi-0.3.0}/zosmfrestapi/models/software.py +0 -0
  27. {zosmfrestapi-0.2.0 → zosmfrestapi-0.3.0}/zosmfrestapi/models/software_updates.py +0 -0
  28. {zosmfrestapi-0.2.0 → zosmfrestapi-0.3.0}/zosmfrestapi/models/topology.py +0 -0
  29. {zosmfrestapi-0.2.0 → zosmfrestapi-0.3.0}/zosmfrestapi/models/workflow.py +0 -0
  30. {zosmfrestapi-0.2.0 → zosmfrestapi-0.3.0}/zosmfrestapi/py.typed +0 -0
  31. {zosmfrestapi-0.2.0 → zosmfrestapi-0.3.0}/zosmfrestapi/services/authentication.py +0 -0
  32. {zosmfrestapi-0.2.0 → zosmfrestapi-0.3.0}/zosmfrestapi/services/dataset.py +0 -0
  33. {zosmfrestapi-0.2.0 → zosmfrestapi-0.3.0}/zosmfrestapi/testing/__init__.py +0 -0
  34. {zosmfrestapi-0.2.0 → zosmfrestapi-0.3.0}/zosmfrestapi/testing/authentication.py +0 -0
  35. {zosmfrestapi-0.2.0 → zosmfrestapi-0.3.0}/zosmfrestapi/testing/helpers.py +0 -0
  36. {zosmfrestapi-0.2.0 → zosmfrestapi-0.3.0}/zosmfrestapi/testing/software.py +0 -0
  37. {zosmfrestapi-0.2.0 → zosmfrestapi-0.3.0}/zosmfrestapi/testing/software_updates.py +0 -0
  38. {zosmfrestapi-0.2.0 → zosmfrestapi-0.3.0}/zosmfrestapi/testing/topology.py +0 -0
  39. {zosmfrestapi-0.2.0 → zosmfrestapi-0.3.0}/zosmfrestapi/testing/workflows.py +0 -0
  40. {zosmfrestapi-0.2.0 → zosmfrestapi-0.3.0}/zosmfrestapi/zcrypto.py +0 -0
@@ -0,0 +1,218 @@
1
+ Metadata-Version: 2.4
2
+ Name: zosmfrestapi
3
+ Version: 0.3.0
4
+ Summary: A Python wrapper for the z/OSMF REST API
5
+ License-Expression: MIT
6
+ License-File: LICENSE
7
+ Keywords: z/OSMF,IBM Z,mainframe,REST API
8
+ Author: Oscar Curero
9
+ Author-email: dev@curero.es
10
+ Requires-Python: >=3.12
11
+ Classifier: Operating System :: OS Independent
12
+ Classifier: Programming Language :: Python :: 3
13
+ Classifier: Programming Language :: Python :: 3.12
14
+ Classifier: Topic :: Internet :: WWW/HTTP
15
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
16
+ Provides-Extra: zcrypto
17
+ Requires-Dist: dacite (>=1.9.2,<2.0.0)
18
+ Requires-Dist: httpx2 (>=2.12.0,<3.0.0)
19
+ Requires-Dist: pendulum (>=3.2.0,<4.0.0)
20
+ Requires-Dist: py_zcrypto ; extra == "zcrypto"
21
+ Project-URL: Homepage, https://sr.ht/~ocurero/zosmfrestapi/
22
+ Project-URL: Issues, https://todo.sr.ht/~ocurero/zosmfrestapi
23
+ Project-URL: PyPI, https://pypi.org/project/zosmfrestapi/
24
+ Project-URL: Repository, https://git.sr.ht/~ocurero/zosmfrestapi
25
+ Description-Content-Type: text/markdown
26
+
27
+ # A Python wrapper for the z/OSMF REST API
28
+
29
+ [![Project Status: Active – The project has reached a stable, usable state and is being actively developed.](https://www.repostatus.org/badges/latest/active.svg)](https://www.repostatus.org/#active)
30
+ [![builds.sr.ht status](https://builds.sr.ht/~ocurero/zosmfrestapi/commits/main/.build.yml.svg)](https://builds.sr.ht/~ocurero/zosmfrestapi/commits/main/.build.yml?)
31
+ [![100% coverage](https://img.shields.io/badge/coverage-100%25-brightgreen)](https://builds.sr.ht/~ocurero/zosmfrestapi/commits/main/.build.yml?)
32
+ [![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)
33
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
34
+ ![z/OS](https://img.shields.io/badge/works%20on-z/OS-8A2BE2)
35
+
36
+ * Website: <https://sr.ht/~ocurero/zosmfrestapi/>
37
+ * Repository: <https://git.sr.ht/~ocurero/zosmfrestapi>
38
+ * Changelog: <https://git.sr.ht/~ocurero/zosmfrestapi/tree/main/item/CHANGELOG.md>
39
+
40
+ Key features:
41
+ * **Pure Python**: Package and its dependencies are 100% pure Python (no C extensions required).
42
+ * **Cross-platform**: Works on Windows, Linux, macOS, and z/OS UNIX System Services.
43
+ * **Flexible authentication**: Supports user/password, LTPA and JWT tokens, and mutual TLS (mTLS).
44
+ * **Proxy ready**: Full support for standard HTTP/HTTPS proxies as well as authenticated proxies.
45
+
46
+ ![ZosmfClient demo](docs/ZosmfClient.gif)
47
+
48
+
49
+ Install
50
+ -------
51
+
52
+ **zosmfrestapi** requires Python 3.12 or newer and access to a z/OSMF server.
53
+
54
+ Install the package from PyPI:
55
+
56
+ ```console
57
+ python -m pip install zosmfrestapi
58
+ ```
59
+
60
+ If you have downloaded or cloned the source code, run this from the project's
61
+ root folder instead:
62
+
63
+ ```console
64
+ python -m pip install .
65
+ ```
66
+
67
+ ## Quickstart
68
+
69
+ ```python
70
+
71
+ from zosmfrestapi import ZosmfClient
72
+
73
+ with ZosmfClient("https://zosmf.example",
74
+ username="demouser", password="itsasecret") as client:
75
+ for instance in client.list_swis():
76
+ print(f"{instance.name} ({instance.system})")
77
+ ```
78
+
79
+ The `with` block closes the network connection automatically, even if a request
80
+ fails. `list_swis()` returns Python objects; the example prints each software
81
+ instance's name and system. You can also query systems or read a data set. Put
82
+ these calls inside the `with` block shown above, before it ends:
83
+
84
+ ```python
85
+ systems = client.get_systems()
86
+ contents = client.read_dataset("USER.DATASET")
87
+ ```
88
+
89
+ These calls must be made inside the `with` block, before the client is closed.
90
+ For a partitioned data set member, use a name such as
91
+ `USER.PDS(MEMBER)`.
92
+
93
+ ## Clients
94
+
95
+ The library provides two client implementations:
96
+
97
+ * **`ZosmfClient`**: The standard synchronous client for communicating with z/OSMF using username/password, tokens, or standard TLS certificate files.
98
+ * **`ZosmfZcryptoClient`**: A specialized client for z/OS environments that extracts mutual TLS (mTLS) client certificates directly from SAF key rings (RACF, ACF2, Top Secret).
99
+
100
+ ### Platform Support
101
+
102
+ | Client | Linux | macOS | Windows | z/OS USS |
103
+ | --- | :---: | :---: | :---: | :---: |
104
+ | `ZosmfClient` | ✅ | ✅ | ✅ | ✅ |
105
+ | `ZosmfZcryptoClient` | ❌ | ❌ | ❌ | ✅ |
106
+
107
+ ### Using `ZosmfZcryptoClient` on z/OS
108
+
109
+ ![ZosmfZcryptoClient demo](docs/ZosmfZcryptoClient.gif)
110
+
111
+ `ZosmfZcryptoClient` retrieves client certificates and private keys directly from a SAF key ring, exporting temporary PEM files and configuring mutual TLS transparently. When using a key ring owned by the current user, specify the ring name as "name". When using a key ring owned by another user, specify the ring name as "userid/name":
112
+
113
+ ```python
114
+ from zosmfrestapi import ZosmfZcryptoClient
115
+
116
+ with ZosmfZcryptoClient("https://zosmf.example",
117
+ keyring="userid/name", label="zOSMF Client Certificate") as client:
118
+ systems = client.get_systems()
119
+ ```
120
+
121
+ Install the optional `zcrypto` extra:
122
+
123
+ ```console
124
+ python -m pip install "zosmfrestapi[zcrypto]"
125
+ ```
126
+
127
+ > [!WARNING]
128
+ > The `zcrypto` extra requires `py_zcrypto`, a C extension that compiles against z/OS System SSL C headers. Therefore, it can **only** be installed and executed on **z/OS** systems. Attempting to install or use `ZosmfZcryptoClient` on Linux, macOS, or Windows will raise a `RuntimeError`.
129
+
130
+
131
+
132
+ ## Authentication and TLS
133
+
134
+ The client uses the server's normal TLS certificate checks by default. Keep
135
+ those checks enabled for routine use. The HTTP transport is HTTPX2; HTTPX2 uses `truststore`
136
+ to integrate operating-system certificate stores when it creates its default TLS context.
137
+ zosmfrestapi currently passes its own context, created with Python's
138
+ `ssl.create_default_context()`, so the certificates available to Python are used.
139
+ If the z/OSMF server's CA is no trusted in that environment, pass its certificate file
140
+ with `cafile` below.
141
+
142
+ | Situation | Client option |
143
+ | --- | --- |
144
+ | User ID and password | `username="...", password="..."` |
145
+ | Client certificate and key in separate files | `cert=("client.crt", "client.key")` |
146
+ | Client certificate and key in one PEM file | `cert="client.pem"` |
147
+ | Internal certificate authority | `cafile="company-ca.pem"` |
148
+ | Existing LTPA or JWT token | `ltpa_token="..."` or `jwt_token="..."` |
149
+ | Identity propagation (needs [PH68412](https://www.ibm.com/support/pages/apar/PH68412)) | None |
150
+ | Network proxy | `proxy="http://proxy.example.com:8080"` |
151
+
152
+ For example, to trust an internal certificate authority, pass `cafile` when
153
+ creating the client:
154
+
155
+ ```python
156
+ with ZosmfClient("https://zosmf.example", username="demouser", password="itsasecret",
157
+ cafile="company-ca.pem") as client:
158
+ systems = client.get_systems()
159
+ ```
160
+
161
+ The `insecure=True` option disables TLS certificate verification; use it only for temporary
162
+ diagnostics, never as a production fix. It cannot be combined with `cert` or `cafile`.
163
+
164
+ ## Supported APIs
165
+
166
+ | API Category | Description | Key Methods (examples) |
167
+ | --- | --- | --- |
168
+ | **Authentication** | Basic Auth, LTPA / JWT tokens session login | `authenticate()` |
169
+ | **Topology** | Query systems and sysplex groups defined in z/OSMF | `get_groups()`, `get_systems()` |
170
+ | **Datasets** | Sequential and partitioned dataset retrieval | `read_dataset()` |
171
+ | **Software Management** | SMP/E software instances, CSI queries, and datasets | `list_swis()`, `get_swi_by_name()`, `query_csi_by_name()` |
172
+ | **Software Updates** | Search, inspect, start, monitor, and cancel update processes | `search_sw_updates_by_name()`, `start_sw_update_by_name()`, `check_sw_update_status()` |
173
+ | **Workflows** | List, create, inspect, execute, monitor, and archive workflows | `get_workflows()`, `create_workflow()`, `start_workflow()`, `wait_for_workflow()` |
174
+
175
+ Some operations change z/OSMF state. Check the method documentation and make
176
+ sure your account has the required permissions before using them.
177
+
178
+ ## Troubleshooting
179
+
180
+ * **Python version error:** install Python 3.12 or newer, then recreate the
181
+ virtual environment with that interpreter.
182
+ * **401 / unauthorized:** check the server URL, user ID, password or token, and
183
+ whether the account is authorized for the requested API.
184
+ * **Certificate verification error:** ask your z/OSMF administrator for the
185
+ correct CA certificate and pass its path with `cafile`.
186
+ * **Connection or timeout error:** check that the server and port are reachable
187
+ from your machine and that any required proxy is configured.
188
+ * **PowerShell will not activate the virtual environment:** use the Python
189
+ executable inside `.venv\Scripts\python.exe` to run commands, or follow your
190
+ organization's PowerShell policy guidance. Do not change the machine-wide
191
+ execution policy just to install this package.
192
+
193
+ For the complete API, parameters, and return types, see the docstrings in the
194
+ package source and the project website.
195
+
196
+ ## Contributing
197
+
198
+ Contributions are welcome! Please see [CONTRIBUTING.md](CONTRIBUTING.md) for guidelines on development, testing, and submitting patches.
199
+
200
+ ## Issues and Feedback
201
+
202
+ If you encounter any bugs or have feature requests, please report them on the [SourceHut issue tracker](https://todo.sr.ht/~ocurero/zosmfrestapi).
203
+
204
+ ## License
205
+
206
+ The MIT License. See [LICENSE](LICENSE).
207
+
208
+ ## Trademarks
209
+
210
+ IBM, the IBM logo, z/OS, MVS, and Z/OSMF are trademarks or are
211
+ registered trademarks of International Business Machines Corporation,
212
+ registered in many jurisdictions worldwide. Other product and service
213
+ names might be trademarks of IBM or other companies. A current list
214
+ of IBM trademarks is available at <https://www.ibm.com/legal/copytrade>.
215
+
216
+ This project is an independent community effort. It is not affiliated
217
+ with, endorsed by, or sponsored by IBM.
218
+
@@ -0,0 +1,191 @@
1
+ # A Python wrapper for the z/OSMF REST API
2
+
3
+ [![Project Status: Active – The project has reached a stable, usable state and is being actively developed.](https://www.repostatus.org/badges/latest/active.svg)](https://www.repostatus.org/#active)
4
+ [![builds.sr.ht status](https://builds.sr.ht/~ocurero/zosmfrestapi/commits/main/.build.yml.svg)](https://builds.sr.ht/~ocurero/zosmfrestapi/commits/main/.build.yml?)
5
+ [![100% coverage](https://img.shields.io/badge/coverage-100%25-brightgreen)](https://builds.sr.ht/~ocurero/zosmfrestapi/commits/main/.build.yml?)
6
+ [![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)
7
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
8
+ ![z/OS](https://img.shields.io/badge/works%20on-z/OS-8A2BE2)
9
+
10
+ * Website: <https://sr.ht/~ocurero/zosmfrestapi/>
11
+ * Repository: <https://git.sr.ht/~ocurero/zosmfrestapi>
12
+ * Changelog: <https://git.sr.ht/~ocurero/zosmfrestapi/tree/main/item/CHANGELOG.md>
13
+
14
+ Key features:
15
+ * **Pure Python**: Package and its dependencies are 100% pure Python (no C extensions required).
16
+ * **Cross-platform**: Works on Windows, Linux, macOS, and z/OS UNIX System Services.
17
+ * **Flexible authentication**: Supports user/password, LTPA and JWT tokens, and mutual TLS (mTLS).
18
+ * **Proxy ready**: Full support for standard HTTP/HTTPS proxies as well as authenticated proxies.
19
+
20
+ ![ZosmfClient demo](docs/ZosmfClient.gif)
21
+
22
+
23
+ Install
24
+ -------
25
+
26
+ **zosmfrestapi** requires Python 3.12 or newer and access to a z/OSMF server.
27
+
28
+ Install the package from PyPI:
29
+
30
+ ```console
31
+ python -m pip install zosmfrestapi
32
+ ```
33
+
34
+ If you have downloaded or cloned the source code, run this from the project's
35
+ root folder instead:
36
+
37
+ ```console
38
+ python -m pip install .
39
+ ```
40
+
41
+ ## Quickstart
42
+
43
+ ```python
44
+
45
+ from zosmfrestapi import ZosmfClient
46
+
47
+ with ZosmfClient("https://zosmf.example",
48
+ username="demouser", password="itsasecret") as client:
49
+ for instance in client.list_swis():
50
+ print(f"{instance.name} ({instance.system})")
51
+ ```
52
+
53
+ The `with` block closes the network connection automatically, even if a request
54
+ fails. `list_swis()` returns Python objects; the example prints each software
55
+ instance's name and system. You can also query systems or read a data set. Put
56
+ these calls inside the `with` block shown above, before it ends:
57
+
58
+ ```python
59
+ systems = client.get_systems()
60
+ contents = client.read_dataset("USER.DATASET")
61
+ ```
62
+
63
+ These calls must be made inside the `with` block, before the client is closed.
64
+ For a partitioned data set member, use a name such as
65
+ `USER.PDS(MEMBER)`.
66
+
67
+ ## Clients
68
+
69
+ The library provides two client implementations:
70
+
71
+ * **`ZosmfClient`**: The standard synchronous client for communicating with z/OSMF using username/password, tokens, or standard TLS certificate files.
72
+ * **`ZosmfZcryptoClient`**: A specialized client for z/OS environments that extracts mutual TLS (mTLS) client certificates directly from SAF key rings (RACF, ACF2, Top Secret).
73
+
74
+ ### Platform Support
75
+
76
+ | Client | Linux | macOS | Windows | z/OS USS |
77
+ | --- | :---: | :---: | :---: | :---: |
78
+ | `ZosmfClient` | ✅ | ✅ | ✅ | ✅ |
79
+ | `ZosmfZcryptoClient` | ❌ | ❌ | ❌ | ✅ |
80
+
81
+ ### Using `ZosmfZcryptoClient` on z/OS
82
+
83
+ ![ZosmfZcryptoClient demo](docs/ZosmfZcryptoClient.gif)
84
+
85
+ `ZosmfZcryptoClient` retrieves client certificates and private keys directly from a SAF key ring, exporting temporary PEM files and configuring mutual TLS transparently. When using a key ring owned by the current user, specify the ring name as "name". When using a key ring owned by another user, specify the ring name as "userid/name":
86
+
87
+ ```python
88
+ from zosmfrestapi import ZosmfZcryptoClient
89
+
90
+ with ZosmfZcryptoClient("https://zosmf.example",
91
+ keyring="userid/name", label="zOSMF Client Certificate") as client:
92
+ systems = client.get_systems()
93
+ ```
94
+
95
+ Install the optional `zcrypto` extra:
96
+
97
+ ```console
98
+ python -m pip install "zosmfrestapi[zcrypto]"
99
+ ```
100
+
101
+ > [!WARNING]
102
+ > The `zcrypto` extra requires `py_zcrypto`, a C extension that compiles against z/OS System SSL C headers. Therefore, it can **only** be installed and executed on **z/OS** systems. Attempting to install or use `ZosmfZcryptoClient` on Linux, macOS, or Windows will raise a `RuntimeError`.
103
+
104
+
105
+
106
+ ## Authentication and TLS
107
+
108
+ The client uses the server's normal TLS certificate checks by default. Keep
109
+ those checks enabled for routine use. The HTTP transport is HTTPX2; HTTPX2 uses `truststore`
110
+ to integrate operating-system certificate stores when it creates its default TLS context.
111
+ zosmfrestapi currently passes its own context, created with Python's
112
+ `ssl.create_default_context()`, so the certificates available to Python are used.
113
+ If the z/OSMF server's CA is no trusted in that environment, pass its certificate file
114
+ with `cafile` below.
115
+
116
+ | Situation | Client option |
117
+ | --- | --- |
118
+ | User ID and password | `username="...", password="..."` |
119
+ | Client certificate and key in separate files | `cert=("client.crt", "client.key")` |
120
+ | Client certificate and key in one PEM file | `cert="client.pem"` |
121
+ | Internal certificate authority | `cafile="company-ca.pem"` |
122
+ | Existing LTPA or JWT token | `ltpa_token="..."` or `jwt_token="..."` |
123
+ | Identity propagation (needs [PH68412](https://www.ibm.com/support/pages/apar/PH68412)) | None |
124
+ | Network proxy | `proxy="http://proxy.example.com:8080"` |
125
+
126
+ For example, to trust an internal certificate authority, pass `cafile` when
127
+ creating the client:
128
+
129
+ ```python
130
+ with ZosmfClient("https://zosmf.example", username="demouser", password="itsasecret",
131
+ cafile="company-ca.pem") as client:
132
+ systems = client.get_systems()
133
+ ```
134
+
135
+ The `insecure=True` option disables TLS certificate verification; use it only for temporary
136
+ diagnostics, never as a production fix. It cannot be combined with `cert` or `cafile`.
137
+
138
+ ## Supported APIs
139
+
140
+ | API Category | Description | Key Methods (examples) |
141
+ | --- | --- | --- |
142
+ | **Authentication** | Basic Auth, LTPA / JWT tokens session login | `authenticate()` |
143
+ | **Topology** | Query systems and sysplex groups defined in z/OSMF | `get_groups()`, `get_systems()` |
144
+ | **Datasets** | Sequential and partitioned dataset retrieval | `read_dataset()` |
145
+ | **Software Management** | SMP/E software instances, CSI queries, and datasets | `list_swis()`, `get_swi_by_name()`, `query_csi_by_name()` |
146
+ | **Software Updates** | Search, inspect, start, monitor, and cancel update processes | `search_sw_updates_by_name()`, `start_sw_update_by_name()`, `check_sw_update_status()` |
147
+ | **Workflows** | List, create, inspect, execute, monitor, and archive workflows | `get_workflows()`, `create_workflow()`, `start_workflow()`, `wait_for_workflow()` |
148
+
149
+ Some operations change z/OSMF state. Check the method documentation and make
150
+ sure your account has the required permissions before using them.
151
+
152
+ ## Troubleshooting
153
+
154
+ * **Python version error:** install Python 3.12 or newer, then recreate the
155
+ virtual environment with that interpreter.
156
+ * **401 / unauthorized:** check the server URL, user ID, password or token, and
157
+ whether the account is authorized for the requested API.
158
+ * **Certificate verification error:** ask your z/OSMF administrator for the
159
+ correct CA certificate and pass its path with `cafile`.
160
+ * **Connection or timeout error:** check that the server and port are reachable
161
+ from your machine and that any required proxy is configured.
162
+ * **PowerShell will not activate the virtual environment:** use the Python
163
+ executable inside `.venv\Scripts\python.exe` to run commands, or follow your
164
+ organization's PowerShell policy guidance. Do not change the machine-wide
165
+ execution policy just to install this package.
166
+
167
+ For the complete API, parameters, and return types, see the docstrings in the
168
+ package source and the project website.
169
+
170
+ ## Contributing
171
+
172
+ Contributions are welcome! Please see [CONTRIBUTING.md](CONTRIBUTING.md) for guidelines on development, testing, and submitting patches.
173
+
174
+ ## Issues and Feedback
175
+
176
+ If you encounter any bugs or have feature requests, please report them on the [SourceHut issue tracker](https://todo.sr.ht/~ocurero/zosmfrestapi).
177
+
178
+ ## License
179
+
180
+ The MIT License. See [LICENSE](LICENSE).
181
+
182
+ ## Trademarks
183
+
184
+ IBM, the IBM logo, z/OS, MVS, and Z/OSMF are trademarks or are
185
+ registered trademarks of International Business Machines Corporation,
186
+ registered in many jurisdictions worldwide. Other product and service
187
+ names might be trademarks of IBM or other companies. A current list
188
+ of IBM trademarks is available at <https://www.ibm.com/legal/copytrade>.
189
+
190
+ This project is an independent community effort. It is not affiliated
191
+ with, endorsed by, or sponsored by IBM.
@@ -1,97 +1,112 @@
1
- [project]
2
- name = "zosmfrestapi"
3
- version = "0.2.0"
4
- description = "A Python wrapper for the z/OSMF REST API"
5
- readme = "README.md"
6
- authors = [
7
- {name = "Oscar Curero",email = "dev@curero.es"}
8
- ]
9
- license = "MIT"
10
- requires-python = ">=3.12"
11
- keywords = ["z/OSMF", "IBM Z", "mainframe", "REST API"]
12
- classifiers = [
13
- "Operating System :: OS Independent",
14
- "Programming Language :: Python :: 3",
15
- "Programming Language :: Python :: 3.12",
16
- "Topic :: Internet :: WWW/HTTP",
17
- "Topic :: Software Development :: Libraries :: Python Modules",
18
- ]
19
- dependencies = [
20
- "httpx2 (>=2.12.0,<3.0.0)",
21
- "pendulum (>=3.2.0,<4.0.0)",
22
- "dacite (>=1.9.2,<2.0.0)",
23
- ]
24
-
25
- [project.urls]
26
- Homepage = "https://sr.ht/~ocurero/zosmfrestapi/"
27
- Repository = "https://sr.ht/~ocurero/zosmfrestapi/"
28
- PyPI = "https://pypi.org/project/zosmfrestapi/"
29
-
30
- [project.optional-dependencies]
31
- zcrypto = [
32
- "py_zcrypto",
33
- ]
34
-
35
- [dependency-groups]
36
- dev = [
37
- "pytest (>=9.1.1,<10.0.0)",
38
- "black (>=26.5.1,<27.0.0)",
39
- "pytest-recording (>=0.14.0,<0.15.0)",
40
- "pytest-httpx2 (>=1.0.0,<2.0.0)",
41
- "pytest-cov (>=7.1.0,<8.0.0)",
42
- "flake8 (>=7.5.0,<8.0.0)",
43
- "flake8-pyproject (>=1.2.4,<2.0.0)",
44
- "mypy (>=2.4.1,<3.0.0)",
45
- "poethepoet (>=0.49.0,<0.50.0)",
46
- "pyright (>=1.1.414,<2.0.0)",
47
- ]
48
- zcrypto-dev = [
49
- "cryptography (>=50.0.2,<51.0.0)"
50
- ]
51
-
52
- [tool.black]
53
- line-length = 96
54
-
55
- [tool.flake8]
56
- max-line-length = 96
57
- extend-ignore = ["E203", "W503"]
58
- per-file-ignores = "tests/*.py:E501"
59
-
60
- [tool.pytest.ini_options]
61
- testpaths = ["tests"]
62
- addopts = ["-ra",
63
- "--record-mode=none",
64
- "--cov-fail-under=100",
65
- "--cov=zosmfrestapi",
66
- ]
67
-
68
-
69
- [tool.poe.tasks]
70
- format = "black ."
71
-
72
- lint = [
73
- { cmd = "black --check ." },
74
- { cmd = "flake8" },
75
- { cmd = "mypy zosmfrestapi" },
76
- { cmd = "pyright --warnings" }
77
-
78
- ]
79
-
80
- test = "pytest"
81
-
82
- check = [
83
- { cmd = "black --check ." },
84
- { cmd = "flake8 zosmfrestapi" },
85
- { cmd = "pyright --warnings" },
86
- { cmd = "mypy zosmfrestapi" },
87
- { cmd = "pytest" }
88
- ]
89
-
90
- [[tool.mypy.overrides]]
91
- module = ["OpenSSL.*", "py_zcrypto.*"]
92
- ignore_missing_imports = true
93
-
94
- [build-system]
95
- requires = ["poetry-core>=2.0.0,<3.0.0"]
96
- build-backend = "poetry.core.masonry.api"
97
-
1
+ [project]
2
+ name = "zosmfrestapi"
3
+ description = "A Python wrapper for the z/OSMF REST API"
4
+ readme = "README.md"
5
+ authors = [
6
+ {name = "Oscar Curero",email = "dev@curero.es"}
7
+ ]
8
+ license = "MIT"
9
+ requires-python = ">=3.12"
10
+ keywords = ["z/OSMF", "IBM Z", "mainframe", "REST API"]
11
+ classifiers = [
12
+ "Operating System :: OS Independent",
13
+ "Programming Language :: Python :: 3",
14
+ "Programming Language :: Python :: 3.12",
15
+ "Topic :: Internet :: WWW/HTTP",
16
+ "Topic :: Software Development :: Libraries :: Python Modules",
17
+ ]
18
+ dependencies = [
19
+ "httpx2 (>=2.12.0,<3.0.0)",
20
+ "pendulum (>=3.2.0,<4.0.0)",
21
+ "dacite (>=1.9.2,<2.0.0)",
22
+ ]
23
+ dynamic = []
24
+ version = "0.3.0"
25
+
26
+ [project.urls]
27
+ Homepage = "https://sr.ht/~ocurero/zosmfrestapi/"
28
+ Repository = "https://git.sr.ht/~ocurero/zosmfrestapi"
29
+ Issues = "https://todo.sr.ht/~ocurero/zosmfrestapi"
30
+ PyPI = "https://pypi.org/project/zosmfrestapi/"
31
+
32
+ [project.optional-dependencies]
33
+ zcrypto = [
34
+ "py_zcrypto",
35
+ ]
36
+
37
+ [dependency-groups]
38
+ dev = [
39
+ "coverage (>=7.17.3,<8.0.0)",
40
+ "pytest (>=9.1.1,<10.0.0)",
41
+ "black (>=26.5.1,<27.0.0)",
42
+ "pytest-recording (>=0.14.0,<0.15.0)",
43
+ "pytest-httpx2 (>=1.0.0,<2.0.0)",
44
+ "flake8 (>=7.5.0,<8.0.0)",
45
+ "flake8-pyproject (>=1.2.4,<2.0.0)",
46
+ "mypy (>=2.4.1,<3.0.0)",
47
+ "poethepoet (>=0.49.0,<0.50.0)",
48
+ "pyright (>=1.1.414,<2.0.0)",
49
+ ]
50
+ zcrypto-dev = [
51
+ "cryptography (>=50.0.2,<51.0.0)"
52
+ ]
53
+
54
+ [tool.black]
55
+ line-length = 96
56
+
57
+ [tool.flake8]
58
+ max-line-length = 96
59
+ extend-ignore = ["E203", "W503"]
60
+ per-file-ignores = "tests/*.py:E501"
61
+
62
+ [tool.pytest.ini_options]
63
+ testpaths = ["tests"]
64
+
65
+
66
+ [tool.poe.groups.quality.tasks.format]
67
+ help = "Format code acording to black."
68
+ cmd = "black zosmfrestapi tests"
69
+
70
+ [tool.poe.groups.quality.tasks.quality]
71
+ help = "Run quality checks: black, flake8, mypy and pyright."
72
+ sequence = [
73
+ { cmd = "black --check ." },
74
+ { cmd = "flake8 zosmfrestapi" },
75
+ { cmd = "mypy zosmfrestapi" },
76
+ { cmd = "pyright --warnings" }
77
+ ]
78
+
79
+ [tool.poe.groups.testing.tasks.client_tests]
80
+ help = "Run client tests only."
81
+ sequence = [{cmd = """coverage run --omit='tests/*,*/zcrypto*' -m
82
+ pytest --ignore=tests/test_zcrypto_client.py"""},
83
+ {cmd = "coverage report --fail-under=100 --show-missing"}
84
+ ]
85
+
86
+ [tool.poe.groups.testing.tasks.zcrypto_tests]
87
+ help = "Run zcrypto tests only."
88
+ sequence = [{cmd = """coverage run --omit='tests/*' --include='*/zcrypto*' -m
89
+ pytest tests/test_zcrypto_client.py"""},
90
+ {cmd = "coverage report --fail-under=100 --show-missing"}
91
+ ]
92
+
93
+ [tool.poe.groups.testing.tasks.tests]
94
+ help = "Run client and zcrypto tests."
95
+ sequence = ["client_tests", "zcrypto_tests"]
96
+
97
+ [tool.poe.tasks.check]
98
+ help = "Run all checks."
99
+ sequence = ["quality", "client_tests", "zcrypto_tests"]
100
+
101
+ [[tool.mypy.overrides]]
102
+ module = ["OpenSSL.*", "py_zcrypto.*"]
103
+ ignore_missing_imports = true
104
+
105
+ [tool.poetry]
106
+
107
+ [tool.poetry-dynamic-versioning]
108
+ enable = false
109
+
110
+ [build-system]
111
+ requires = ["poetry-core>=1.0.0", "poetry-dynamic-versioning>=1.0.0,<2.0.0"]
112
+ build-backend = "poetry_dynamic_versioning.backend"
@@ -0,0 +1,11 @@
1
+ """Synchronous Python client for the z/OSMF REST API.
2
+
3
+ The package root re-exports :class:`ZosmfClient` and :class:`ZosmfZcryptoClient`.
4
+ Create one client per server/configuration and use it as a context manager to close
5
+ the shared HTTP session when finished.
6
+ """
7
+
8
+ from zosmfrestapi.client import ZosmfClient
9
+ from zosmfrestapi.zcrypto_client import ZosmfZcryptoClient
10
+
11
+ __all__ = ["ZosmfClient", "ZosmfZcryptoClient"]
@@ -4,7 +4,7 @@ from typing import Any
4
4
  import pendulum
5
5
 
6
6
 
7
- def _parse_datetime(value: str) -> pendulum.DateTime:
7
+ def parse_datetime(value: str) -> pendulum.DateTime:
8
8
  """Parse a string and require a Pendulum ``DateTime`` result.
9
9
 
10
10
  Args:
@@ -0,0 +1,21 @@
1
+ from zosmfrestapi.exceptions.commons import ZosmfAuthError, ZosmfError
2
+ from zosmfrestapi.exceptions.authentication import ZosmfLoginError
3
+ from zosmfrestapi.exceptions.dataset import ZosmfDatasetNotFoundError
4
+ from zosmfrestapi.exceptions.software import (
5
+ ZosmfSoftwareInstanceNotFoundError,
6
+ ZosmfSoftwareManagementError,
7
+ ZosmfSoftwareManagementRequestError,
8
+ )
9
+ from zosmfrestapi.exceptions.workflow import ZosmfWorkflowBaseError, ZosmfWorkflowError
10
+
11
+ __all__ = [
12
+ "ZosmfDatasetNotFoundError",
13
+ "ZosmfError",
14
+ "ZosmfAuthError",
15
+ "ZosmfLoginError",
16
+ "ZosmfSoftwareManagementError",
17
+ "ZosmfSoftwareInstanceNotFoundError",
18
+ "ZosmfSoftwareManagementRequestError",
19
+ "ZosmfWorkflowBaseError",
20
+ "ZosmfWorkflowError",
21
+ ]