This client is used to interact with the API found at openapi.it
Before using the OpenApi IT Python Client, you will need an account at openapi.it and an API key to the sandbox and/or production environment
You can install the OpenApi IT Python Client with the following command using go get:
pip install openapi-cli-pythonfrom openapi.client import Client, OauthClient
# Initialize the oauth client on the sandbox environment
oauth_client = OauthClient(
username="<your_username>", apikey="<your_apikey>", test=True
)
# Create a token for a list of scopes
resp = oauth_client.create_token(
scopes=[
"GET:test.imprese.openapi.it/advance",
"POST:test.postontarget.com/fields/country",
],
ttl=3600,
)
token = resp["token"]
# Initialize the client
client = Client(token=token)
# Make a request with params
resp = client.request(
method="GET",
url="https://test.imprese.openapi.it/advance",
params={"denominazione": "altravia", "provincia": "RM", "codice_ateco": "6201"},
)
# Make a request with a payload
resp = client.request(
method="POST",
url="https://test.postontarget.com/fields/country",
payload={"limit": 0, "query": { "country_code": "IT"}}
)
# Delete the token
resp = oauth_client.delete_token(id=token)Contributions are always welcome!
See contributing.md for ways to get started.
Please adhere to this project's code of conduct.