openapi-python-sdk 0.1.0__tar.gz → 0.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,119 @@
1
+ Metadata-Version: 2.4
2
+ Name: openapi-python-sdk
3
+ Version: 0.2.0
4
+ Summary: A minimal Python SDK for the Openapi® API marketplace
5
+ Author: Michael Cuffaro
6
+ Author-email: michael@cuffaro.com
7
+ Requires-Python: >=3.10,<4.0
8
+ Classifier: Programming Language :: Python :: 3
9
+ Classifier: Programming Language :: Python :: 3.10
10
+ Classifier: Programming Language :: Python :: 3.11
11
+ Classifier: Programming Language :: Python :: 3.12
12
+ Classifier: Programming Language :: Python :: 3.13
13
+ Classifier: Programming Language :: Python :: 3.14
14
+ Requires-Dist: httpx (>=0.24.0,<0.25.0)
15
+ Description-Content-Type: text/markdown
16
+
17
+ # openapi-python-sdk
18
+
19
+ A minimal Python SDK for [Openapi®](https://openapi.it) — the largest certified API marketplace in Italy.
20
+ Provides the core HTTP primitives to authenticate and interact with any Openapi service, without API-specific coupling.
21
+
22
+ ## Requirements
23
+
24
+ - Python 3.10+
25
+ - An account on [console.openapi.com](https://console.openapi.com/) with a valid API key
26
+
27
+ ## Installation
28
+
29
+ ```bash
30
+ pip install openapi-python-sdk
31
+ ```
32
+
33
+ ## Usage
34
+
35
+ Interaction with the Openapi platform happens in two distinct steps.
36
+
37
+ ### Step 1 — Generate a token
38
+
39
+ ```python
40
+ from openapi_python_sdk.client import OauthClient
41
+
42
+ oauth = OauthClient(username="<your_username>", apikey="<your_apikey>", test=True)
43
+
44
+ resp = oauth.create_token(
45
+ scopes=[
46
+ "GET:test.imprese.openapi.it/advance",
47
+ "POST:test.postontarget.com/fields/country",
48
+ ],
49
+ ttl=3600,
50
+ )
51
+ token = resp["token"]
52
+
53
+ # Revoke the token when done
54
+ oauth.delete_token(id=token)
55
+ ```
56
+
57
+ ### Step 2 — Call an API endpoint
58
+
59
+ ```python
60
+ from openapi_python_sdk.client import Client
61
+
62
+ client = Client(token=token)
63
+
64
+ # GET with query params
65
+ resp = client.request(
66
+ method="GET",
67
+ url="https://test.imprese.openapi.it/advance",
68
+ params={"denominazione": "altravia", "provincia": "RM", "codice_ateco": "6201"},
69
+ )
70
+
71
+ # POST with a JSON payload
72
+ resp = client.request(
73
+ method="POST",
74
+ url="https://test.postontarget.com/fields/country",
75
+ payload={"limit": 0, "query": {"country_code": "IT"}},
76
+ )
77
+ ```
78
+
79
+ ## Testing
80
+
81
+ ```bash
82
+ pip install pytest
83
+ pytest
84
+ ```
85
+
86
+ ## OauthClient API
87
+
88
+ | Method | Description |
89
+ |---|---|
90
+ | `OauthClient(username, apikey, test=False)` | Initialize the OAuth client. Set `test=True` for sandbox. |
91
+ | `create_token(scopes, ttl)` | Create a bearer token for the given scopes and TTL (seconds). |
92
+ | `get_token(scope)` | Retrieve an existing token by scope. |
93
+ | `delete_token(id)` | Revoke a token by ID. |
94
+ | `get_scopes(limit=False)` | List available scopes. |
95
+ | `get_counters(period, date)` | Retrieve usage counters for a given period and date. |
96
+
97
+ ## Client API
98
+
99
+ | Method | Description |
100
+ |---|---|
101
+ | `Client(token)` | Initialize the client with a bearer token. |
102
+ | `request(method, url, payload, params)` | Execute an HTTP request against any Openapi endpoint. |
103
+
104
+ ## Links
105
+
106
+ - Homepage: [openapi.it](https://openapi.it)
107
+ - Console & API keys: [console.openapi.com](https://console.openapi.com/)
108
+ - GitHub: [github.com/openapi/openapi-python-sdk](https://github.com/openapi/openapi-python-sdk)
109
+ - Issue tracker: [github.com/openapi/openapi-python-sdk/issues](https://github.com/openapi/openapi-python-sdk/issues)
110
+
111
+ ## License
112
+
113
+ MIT — see [LICENSE](https://github.com/openapi/openapi-python-sdk/blob/main/LICENSE) for details.
114
+
115
+ ## Authors
116
+
117
+ - Michael Cuffaro ([@maiku1008](https://github.com/maiku1008))
118
+ - Openapi Team ([@openapi-it](https://github.com/openapi-it))
119
+
@@ -0,0 +1,102 @@
1
+ # openapi-python-sdk
2
+
3
+ A minimal Python SDK for [Openapi®](https://openapi.it) — the largest certified API marketplace in Italy.
4
+ Provides the core HTTP primitives to authenticate and interact with any Openapi service, without API-specific coupling.
5
+
6
+ ## Requirements
7
+
8
+ - Python 3.10+
9
+ - An account on [console.openapi.com](https://console.openapi.com/) with a valid API key
10
+
11
+ ## Installation
12
+
13
+ ```bash
14
+ pip install openapi-python-sdk
15
+ ```
16
+
17
+ ## Usage
18
+
19
+ Interaction with the Openapi platform happens in two distinct steps.
20
+
21
+ ### Step 1 — Generate a token
22
+
23
+ ```python
24
+ from openapi_python_sdk.client import OauthClient
25
+
26
+ oauth = OauthClient(username="<your_username>", apikey="<your_apikey>", test=True)
27
+
28
+ resp = oauth.create_token(
29
+ scopes=[
30
+ "GET:test.imprese.openapi.it/advance",
31
+ "POST:test.postontarget.com/fields/country",
32
+ ],
33
+ ttl=3600,
34
+ )
35
+ token = resp["token"]
36
+
37
+ # Revoke the token when done
38
+ oauth.delete_token(id=token)
39
+ ```
40
+
41
+ ### Step 2 — Call an API endpoint
42
+
43
+ ```python
44
+ from openapi_python_sdk.client import Client
45
+
46
+ client = Client(token=token)
47
+
48
+ # GET with query params
49
+ resp = client.request(
50
+ method="GET",
51
+ url="https://test.imprese.openapi.it/advance",
52
+ params={"denominazione": "altravia", "provincia": "RM", "codice_ateco": "6201"},
53
+ )
54
+
55
+ # POST with a JSON payload
56
+ resp = client.request(
57
+ method="POST",
58
+ url="https://test.postontarget.com/fields/country",
59
+ payload={"limit": 0, "query": {"country_code": "IT"}},
60
+ )
61
+ ```
62
+
63
+ ## Testing
64
+
65
+ ```bash
66
+ pip install pytest
67
+ pytest
68
+ ```
69
+
70
+ ## OauthClient API
71
+
72
+ | Method | Description |
73
+ |---|---|
74
+ | `OauthClient(username, apikey, test=False)` | Initialize the OAuth client. Set `test=True` for sandbox. |
75
+ | `create_token(scopes, ttl)` | Create a bearer token for the given scopes and TTL (seconds). |
76
+ | `get_token(scope)` | Retrieve an existing token by scope. |
77
+ | `delete_token(id)` | Revoke a token by ID. |
78
+ | `get_scopes(limit=False)` | List available scopes. |
79
+ | `get_counters(period, date)` | Retrieve usage counters for a given period and date. |
80
+
81
+ ## Client API
82
+
83
+ | Method | Description |
84
+ |---|---|
85
+ | `Client(token)` | Initialize the client with a bearer token. |
86
+ | `request(method, url, payload, params)` | Execute an HTTP request against any Openapi endpoint. |
87
+
88
+ ## Links
89
+
90
+ - Homepage: [openapi.it](https://openapi.it)
91
+ - Console & API keys: [console.openapi.com](https://console.openapi.com/)
92
+ - GitHub: [github.com/openapi/openapi-python-sdk](https://github.com/openapi/openapi-python-sdk)
93
+ - Issue tracker: [github.com/openapi/openapi-python-sdk/issues](https://github.com/openapi/openapi-python-sdk/issues)
94
+
95
+ ## License
96
+
97
+ MIT — see [LICENSE](https://github.com/openapi/openapi-python-sdk/blob/main/LICENSE) for details.
98
+
99
+ ## Authors
100
+
101
+ - Michael Cuffaro ([@maiku1008](https://github.com/maiku1008))
102
+ - Openapi Team ([@openapi-it](https://github.com/openapi-it))
@@ -1,15 +1,20 @@
1
1
  [tool.poetry]
2
2
  name = "openapi-python-sdk"
3
- version = "0.1.0"
4
- description = ""
3
+ version = "0.2.0"
4
+ description = "A minimal Python SDK for the Openapi® API marketplace"
5
5
  authors = ["Michael Cuffaro <michael@cuffaro.com>"]
6
- readme = "README.md"
6
+ readme = "docs/readme-pypi.md"
7
7
  packages = [{include = "openapi_python_sdk"}]
8
8
 
9
9
  [tool.poetry.dependencies]
10
10
  python = "^3.10"
11
11
  httpx = "^0.24.0"
12
12
 
13
+ [tool.poetry.group.dev.dependencies]
14
+ pytest = "^8.0"
15
+
16
+ [tool.pytest.ini_options]
17
+ testpaths = ["tests"]
13
18
 
14
19
  [build-system]
15
20
  requires = ["poetry-core"]
@@ -1,168 +0,0 @@
1
- Metadata-Version: 2.4
2
- Name: openapi-python-sdk
3
- Version: 0.1.0
4
- Summary:
5
- Author: Michael Cuffaro
6
- Author-email: michael@cuffaro.com
7
- Requires-Python: >=3.10,<4.0
8
- Classifier: Programming Language :: Python :: 3
9
- Classifier: Programming Language :: Python :: 3.10
10
- Classifier: Programming Language :: Python :: 3.11
11
- Classifier: Programming Language :: Python :: 3.12
12
- Classifier: Programming Language :: Python :: 3.13
13
- Classifier: Programming Language :: Python :: 3.14
14
- Requires-Dist: httpx (>=0.24.0,<0.25.0)
15
- Description-Content-Type: text/markdown
16
-
17
- <div align="center">
18
- <a href="https://openapi.com/">
19
- <img alt="Openapi SDK for Python" src=".github/assets/repo-header-a3.png" >
20
- </a>
21
-
22
- <h1>Openapi® client for Python</h1>
23
- <h4>The perfect starting point to integrate <a href="https://openapi.com/">Openapi®</a> within your Python project</h4>
24
-
25
- [![Build](https://github.com/openapi/openapi-python-sdk/actions/workflows/python.yml/badge.svg)](https://github.com/openapi/openapi-python-sdk/actions/workflows/python.yml)
26
- [![PyPI Version](https://img.shields.io/pypi/v/openapi-python-sdk)](https://pypi.org/project/openapi-python-sdk/)
27
- [![Python Versions](https://img.shields.io/pypi/pyversions/openapi-python-sdk)](https://pypi.org/project/openapi-python-sdk/)
28
- [![License](https://img.shields.io/github/license/openapi/openapi-python-sdk)](LICENSE)
29
- [![Downloads](https://img.shields.io/pypi/dm/openapi-python-sdk)](https://pypi.org/project/openapi-python-sdk/)
30
- <br>
31
- [![Linux Foundation Member](https://img.shields.io/badge/Linux%20Foundation-Silver%20Member-003778?logo=linux-foundation&logoColor=white)](https://www.linuxfoundation.org/about/members)
32
- </div>
33
-
34
- ## Overview
35
-
36
- A minimal and agnostic Python SDK for Openapi, inspired by a clean client implementation. This SDK provides only the core HTTP primitives needed to interact with any Openapi service.
37
-
38
- ## Pre-requisites
39
-
40
- Before using the Openapi Python Client, you will need an account at [Openapi](https://console.openapi.com/) and an API key to the sandbox and/or production environment
41
-
42
- ## Features
43
-
44
- - **Agnostic Design**: No API-specific classes, works with any OpenAPI service
45
- - **Minimal Dependencies**: Only requires Python 3.8+ and `requests`
46
- - **OAuth Support**: Built-in OAuth client for token management
47
- - **HTTP Primitives**: GET, POST, PUT, DELETE, PATCH methods
48
- - **Clean Interface**: Similar to the Rust SDK design
49
-
50
- ## What you can do
51
-
52
- With the Openapi Python Client, you can easily interact with a variety of services in the Openapi Marketplace. For example, you can:
53
-
54
- - 📩 **Send SMS messages** with delivery reports and custom sender IDs
55
- - 💸 **Process bills and payments** in real time via API
56
- - 🧾 **Send electronic invoices** securely to the Italian Revenue Agency
57
- - 📄 **Generate PDFs** from HTML content, including JavaScript rendering
58
- - ✉️ **Manage certified emails** and legal communications via Italian Legalmail
59
-
60
- For a complete list of all available services, check out the [Openapi Marketplace](https://console.openapi.com/) 🌐
61
-
62
- # OpenApi IT Python Client
63
-
64
- This client is used to interact with the API found at [openapi.it](https://openapi.it/)
65
-
66
- ## Pre-requisites
67
-
68
- Before using the OpenApi IT Python Client, you will need an account at [openapi.it](https://openapi.it/) and an API key to the sandbox and/or production environment
69
-
70
- ## Installation
71
-
72
- You can install the OpenApi IT Python Client with the following command using go get:
73
-
74
- ```bash
75
- pip install openapi-python-sdk
76
- ```
77
-
78
- ## Usage
79
-
80
-
81
- ```python
82
- from openapi_python_sdk.client import Client, OauthClient
83
-
84
- # Initialize the oauth client on the sandbox environment
85
- oauth_client = OauthClient(
86
- username="<your_username>", apikey="<your_apikey>", test=True
87
- )
88
-
89
- # Create a token for a list of scopes
90
- resp = oauth_client.create_token(
91
- scopes=[
92
- "GET:test.imprese.openapi.it/advance",
93
- "POST:test.postontarget.com/fields/country",
94
- ],
95
- ttl=3600,
96
- )
97
- token = resp["token"]
98
-
99
- # Initialize the client
100
- client = Client(token=token)
101
-
102
- # Make a request with params
103
- resp = client.request(
104
- method="GET",
105
- url="https://test.imprese.openapi.it/advance",
106
- params={"denominazione": "altravia", "provincia": "RM", "codice_ateco": "6201"},
107
- )
108
-
109
- # Make a request with a payload
110
- resp = client.request(
111
- method="POST",
112
- url="https://test.postontarget.com/fields/country",
113
- payload={"limit": 0, "query": { "country_code": "IT"}}
114
- )
115
-
116
- # Delete the token
117
- resp = oauth_client.delete_token(id=token)
118
- ```
119
-
120
-
121
-
122
-
123
- ## Contributing
124
-
125
- Contributions are always welcome! Whether you want to report bugs, suggest new features, improve documentation, or contribute code, your help is appreciated.
126
-
127
- See [docs/contributing.md](docs/contributing.md) for detailed instructions on how to get started. Please make sure to follow this project's [docs/code-of-conduct.md](docs/code-of-conduct.md) to help maintain a welcoming and collaborative environment.
128
-
129
- ## Authors
130
-
131
- Meet the project authors:
132
-
133
- - Michael Cuffaro ([@maiku1008](https://www.github.com/maiku1008))
134
- - Openapi Team ([@openapi-it](https://github.com/openapi-it))
135
-
136
- ## Partners
137
-
138
- Meet our partners using Openapi or contributing to this SDK:
139
-
140
- - [Blank](https://www.blank.app/)
141
- - [Credit Safe](https://www.creditsafe.com/)
142
- - [Deliveroo](https://deliveroo.it/)
143
- - [Gruppo MOL](https://molgroupitaly.it/it/)
144
- - [Jakala](https://www.jakala.com/)
145
- - [Octotelematics](https://www.octotelematics.com/)
146
- - [OTOQI](https://otoqi.com/)
147
- - [PWC](https://www.pwc.com/)
148
- - [QOMODO S.R.L.](https://www.qomodo.me/)
149
- - [SOUNDREEF S.P.A.](https://www.soundreef.com/)
150
-
151
- ## Our Commitments
152
-
153
- We believe in open source and we act on that belief. We became Silver Members
154
- of the Linux Foundation because we wanted to formally support the ecosystem
155
- we build on every day. Open standards, open collaboration, and open governance
156
- are part of how we work and how we think about software.
157
-
158
- ## License
159
-
160
- This project is licensed under the [MIT License](LICENSE).
161
-
162
- The MIT License is a permissive open-source license that allows you to freely use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the software, provided that the original copyright notice and this permission notice are included in all copies or substantial portions of the software.
163
-
164
- In short, you are free to use this SDK in your personal, academic, or commercial projects, with minimal restrictions. The project is provided "as-is", without any warranty of any kind, either expressed or implied, including but not limited to the warranties of merchantability, fitness for a particular purpose, and non-infringement.
165
-
166
- For more details, see the full license text at the [MIT License page](https://choosealicense.com/licenses/mit/).
167
-
168
-
@@ -1,151 +0,0 @@
1
- <div align="center">
2
- <a href="https://openapi.com/">
3
- <img alt="Openapi SDK for Python" src=".github/assets/repo-header-a3.png" >
4
- </a>
5
-
6
- <h1>Openapi® client for Python</h1>
7
- <h4>The perfect starting point to integrate <a href="https://openapi.com/">Openapi®</a> within your Python project</h4>
8
-
9
- [![Build](https://github.com/openapi/openapi-python-sdk/actions/workflows/python.yml/badge.svg)](https://github.com/openapi/openapi-python-sdk/actions/workflows/python.yml)
10
- [![PyPI Version](https://img.shields.io/pypi/v/openapi-python-sdk)](https://pypi.org/project/openapi-python-sdk/)
11
- [![Python Versions](https://img.shields.io/pypi/pyversions/openapi-python-sdk)](https://pypi.org/project/openapi-python-sdk/)
12
- [![License](https://img.shields.io/github/license/openapi/openapi-python-sdk)](LICENSE)
13
- [![Downloads](https://img.shields.io/pypi/dm/openapi-python-sdk)](https://pypi.org/project/openapi-python-sdk/)
14
- <br>
15
- [![Linux Foundation Member](https://img.shields.io/badge/Linux%20Foundation-Silver%20Member-003778?logo=linux-foundation&logoColor=white)](https://www.linuxfoundation.org/about/members)
16
- </div>
17
-
18
- ## Overview
19
-
20
- A minimal and agnostic Python SDK for Openapi, inspired by a clean client implementation. This SDK provides only the core HTTP primitives needed to interact with any Openapi service.
21
-
22
- ## Pre-requisites
23
-
24
- Before using the Openapi Python Client, you will need an account at [Openapi](https://console.openapi.com/) and an API key to the sandbox and/or production environment
25
-
26
- ## Features
27
-
28
- - **Agnostic Design**: No API-specific classes, works with any OpenAPI service
29
- - **Minimal Dependencies**: Only requires Python 3.8+ and `requests`
30
- - **OAuth Support**: Built-in OAuth client for token management
31
- - **HTTP Primitives**: GET, POST, PUT, DELETE, PATCH methods
32
- - **Clean Interface**: Similar to the Rust SDK design
33
-
34
- ## What you can do
35
-
36
- With the Openapi Python Client, you can easily interact with a variety of services in the Openapi Marketplace. For example, you can:
37
-
38
- - 📩 **Send SMS messages** with delivery reports and custom sender IDs
39
- - 💸 **Process bills and payments** in real time via API
40
- - 🧾 **Send electronic invoices** securely to the Italian Revenue Agency
41
- - 📄 **Generate PDFs** from HTML content, including JavaScript rendering
42
- - ✉️ **Manage certified emails** and legal communications via Italian Legalmail
43
-
44
- For a complete list of all available services, check out the [Openapi Marketplace](https://console.openapi.com/) 🌐
45
-
46
- # OpenApi IT Python Client
47
-
48
- This client is used to interact with the API found at [openapi.it](https://openapi.it/)
49
-
50
- ## Pre-requisites
51
-
52
- Before using the OpenApi IT Python Client, you will need an account at [openapi.it](https://openapi.it/) and an API key to the sandbox and/or production environment
53
-
54
- ## Installation
55
-
56
- You can install the OpenApi IT Python Client with the following command using go get:
57
-
58
- ```bash
59
- pip install openapi-python-sdk
60
- ```
61
-
62
- ## Usage
63
-
64
-
65
- ```python
66
- from openapi_python_sdk.client import Client, OauthClient
67
-
68
- # Initialize the oauth client on the sandbox environment
69
- oauth_client = OauthClient(
70
- username="<your_username>", apikey="<your_apikey>", test=True
71
- )
72
-
73
- # Create a token for a list of scopes
74
- resp = oauth_client.create_token(
75
- scopes=[
76
- "GET:test.imprese.openapi.it/advance",
77
- "POST:test.postontarget.com/fields/country",
78
- ],
79
- ttl=3600,
80
- )
81
- token = resp["token"]
82
-
83
- # Initialize the client
84
- client = Client(token=token)
85
-
86
- # Make a request with params
87
- resp = client.request(
88
- method="GET",
89
- url="https://test.imprese.openapi.it/advance",
90
- params={"denominazione": "altravia", "provincia": "RM", "codice_ateco": "6201"},
91
- )
92
-
93
- # Make a request with a payload
94
- resp = client.request(
95
- method="POST",
96
- url="https://test.postontarget.com/fields/country",
97
- payload={"limit": 0, "query": { "country_code": "IT"}}
98
- )
99
-
100
- # Delete the token
101
- resp = oauth_client.delete_token(id=token)
102
- ```
103
-
104
-
105
-
106
-
107
- ## Contributing
108
-
109
- Contributions are always welcome! Whether you want to report bugs, suggest new features, improve documentation, or contribute code, your help is appreciated.
110
-
111
- See [docs/contributing.md](docs/contributing.md) for detailed instructions on how to get started. Please make sure to follow this project's [docs/code-of-conduct.md](docs/code-of-conduct.md) to help maintain a welcoming and collaborative environment.
112
-
113
- ## Authors
114
-
115
- Meet the project authors:
116
-
117
- - Michael Cuffaro ([@maiku1008](https://www.github.com/maiku1008))
118
- - Openapi Team ([@openapi-it](https://github.com/openapi-it))
119
-
120
- ## Partners
121
-
122
- Meet our partners using Openapi or contributing to this SDK:
123
-
124
- - [Blank](https://www.blank.app/)
125
- - [Credit Safe](https://www.creditsafe.com/)
126
- - [Deliveroo](https://deliveroo.it/)
127
- - [Gruppo MOL](https://molgroupitaly.it/it/)
128
- - [Jakala](https://www.jakala.com/)
129
- - [Octotelematics](https://www.octotelematics.com/)
130
- - [OTOQI](https://otoqi.com/)
131
- - [PWC](https://www.pwc.com/)
132
- - [QOMODO S.R.L.](https://www.qomodo.me/)
133
- - [SOUNDREEF S.P.A.](https://www.soundreef.com/)
134
-
135
- ## Our Commitments
136
-
137
- We believe in open source and we act on that belief. We became Silver Members
138
- of the Linux Foundation because we wanted to formally support the ecosystem
139
- we build on every day. Open standards, open collaboration, and open governance
140
- are part of how we work and how we think about software.
141
-
142
- ## License
143
-
144
- This project is licensed under the [MIT License](LICENSE).
145
-
146
- The MIT License is a permissive open-source license that allows you to freely use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the software, provided that the original copyright notice and this permission notice are included in all copies or substantial portions of the software.
147
-
148
- In short, you are free to use this SDK in your personal, academic, or commercial projects, with minimal restrictions. The project is provided "as-is", without any warranty of any kind, either expressed or implied, including but not limited to the warranties of merchantability, fitness for a particular purpose, and non-infringement.
149
-
150
- For more details, see the full license text at the [MIT License page](https://choosealicense.com/licenses/mit/).
151
-