Python Quickstart
Work in progress
The contents of this page currently mirror the README file in the Python SDK repository. For an up-to-date version, make sure to check the repository itself.
Interested?
Are you interested in a stand-alone Quickstart for your language? Let us know, or contribute one yourself!
Not receiving invoices in the live environment?
Ensure your correspondents use 7HD37X0 as the value of their invoices' Codice Destinatario
field. That is how SDI knows they should be forwarded to the Invoicetronic API.
Requirements.
Python 3.8+
Installation & Usage
pip install
If the python package is hosted on a repository, you can install directly using:
(you may need to runpip
with root permission: sudo pip install git+https://github.com/invoicetronic/python-sdk.git
)
Then import the package:
Setuptools
Install via Setuptools.
(orsudo python setup.py install
to install the package for all users)
Then import the package:
Tests
Execute pytest
to run the tests.
Getting Started
Please follow the installation procedure and then run the following:
import invoicetronic_invoice_sdk
from invoicetronic_invoice_sdk.rest import ApiException
from pprint import pprint
# Defining the host is optional and defaults to https://api.invoicetronic.com
# See configuration.py for a list of all supported configuration parameters.
configuration = invoicetronic_invoice_sdk.Configuration(
host = "https://api.invoicetronic.com"
)
# The client must configure the authentication and authorization parameters
# in accordance with the API server security policy.
# Examples for each auth method are provided below, use the example that
# satisfies your auth use case.
# Configure HTTP basic authorization: Basic
configuration = invoicetronic_invoice_sdk.Configuration(
username = os.environ["USERNAME"],
password = os.environ["PASSWORD"]
)
# Enter a context with an instance of the API client
with invoicetronic_invoice_sdk.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = invoicetronic_invoice_sdk.CompanyApi(api_client)
page = 1 # int | Page number. Defaults to 1. (optional) (default to 1)
page_size = 100 # int | Items per page. Defaults to 50. Cannot be greater than 200. (optional) (default to 100)
try:
# List companies
api_response = api_instance.invoice_v1_company_get(page=page, page_size=page_size)
print("The response of CompanyApi->invoice_v1_company_get:\n")
pprint(api_response)
except ApiException as e:
print("Exception when calling CompanyApi->invoice_v1_company_get: %s\n" % e)