openapi-python-sdk
A minimal Python SDK for Openapi® — the largest certified API marketplace in Italy. Provides the core HTTP primitives to authenticate and interact with any Openapi service, without API-specific coupling.
Requirements
- Python 3.10+
- An account on console.openapi.com with a valid API key
Installation
pip install openapi-python-sdk
Usage
Interaction with the Openapi platform happens in two distinct steps.
Step 1 — Generate a token
from openapi_python_sdk.client import OauthClient
oauth = OauthClient(username="<your_username>", apikey="<your_apikey>", test=True)
resp = oauth.create_token(
scopes=[
"GET:test.imprese.openapi.it/advance",
"POST:test.postontarget.com/fields/country",
],
ttl=3600,
)
token = resp["token"]
# Revoke the token when done
oauth.delete_token(id=token)
Step 2 — Call an API endpoint
from openapi_python_sdk.client import Client
client = Client(token=token)
# GET with query params
resp = client.request(
method="GET",
url="https://test.imprese.openapi.it/advance",
params={"denominazione": "altravia", "provincia": "RM", "codice_ateco": "6201"},
)
# POST with a JSON payload
resp = client.request(
method="POST",
url="https://test.postontarget.com/fields/country",
payload={"limit": 0, "query": {"country_code": "IT"}},
)
Testing
pip install pytest
pytest
OauthClient API
| Method | Description |
|---|---|
OauthClient(username, apikey, test=False) |
Initialize the OAuth client. Set test=True for sandbox. |
create_token(scopes, ttl) |
Create a bearer token for the given scopes and TTL (seconds). |
get_token(scope) |
Retrieve an existing token by scope. |
delete_token(id) |
Revoke a token by ID. |
get_scopes(limit=False) |
List available scopes. |
get_counters(period, date) |
Retrieve usage counters for a given period and date. |
Client API
| Method | Description |
|---|---|
Client(token) |
Initialize the client with a bearer token. |
request(method, url, payload, params) |
Execute an HTTP request against any Openapi endpoint. |
Links
- Homepage: openapi.it
- Console & API keys: console.openapi.com
- GitHub: github.com/openapi/openapi-python-sdk
- Issue tracker: github.com/openapi/openapi-python-sdk/issues
License
MIT — see LICENSE for details.
Authors
- Michael Cuffaro (@maiku1008)
- Openapi Team (@openapi-it)
Metadata
Release files for openapi-python-sdk 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| openapi_python_sdk-0.2.0.tar.gz | 2.5 kB | Without provenance | Details for openapi_python_sdk-0.2.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| openapi_python_sdk-0.2.0-py3-none-any.whl | Python 3 | none | any | Details for openapi_python_sdk-0.2.0-py3-none-any.whl |
Total release size: 5.7 kB
Release files / openapi_python_sdk-0.2.0.tar.gz
| Download URL | openapi_python_sdk-0.2.0.tar.gz |
|---|---|
| Size | 2.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
067a7b61fd4bec0456cb2d5fc4daa722dc44cad0bbaa64c5cd194327d1176342
|
|
BLAKE2b-256 checksum How to use checksums |
f6a9b5eaa81956ef95d8d8e1889dd0d99073f038ec3eb9419246f32688b1f841
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/2.3.2 CPython/3.12.3 Linux/6.8.0-106-generic
|
Release files / openapi_python_sdk-0.2.0-py3-none-any.whl
| Download URL | openapi_python_sdk-0.2.0-py3-none-any.whl |
|---|---|
| Size | 3.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
d96582563dddfa021bd7c00645b790ede39aee651a23bf0fb19267afd6c8e4f0
|
|
BLAKE2b-256 checksum How to use checksums |
ce608ee425a074eb7e9ebb93d58b128097f1f02e6557e9161a0c14dd5875bacb
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/2.3.2 CPython/3.12.3 Linux/6.8.0-106-generic
|
Security for openapi-python-sdk 0.2.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.