xero-sdk-py
Python SDK to access Xero APIs
Requirements
Installation
Install Xero SDK using pip as follows:
pip install xerosdk
Usage
This SDK requires OAuth2 authentication credentials such as client ID, client secret and refresh token.
- Create a connection using the XeroSDK class.
from xerosdk import XeroSDK
connection = XeroSDK(
base_url='<XERO_BASE_URL>',
client_id='<YOUR CLIENT ID>',
client_secret='<YOUR CLIENT SECRET>',
refresh_token='<YOUR REFRESH TOKEN>'
)
# tenant_id is required to make a call to any API
tenant_id = connection.tenants.get_all()[0]['tenantId']
connection.set_tenant_id(tenant_id)
- Access any of the API classes
"""
USAGE: <XeroSDK INSTANCE>.<API_NAME>.<API_METHOD>(<PARAMETERS>)
"""
# Get a list of all Invoices
response = connection.invoices.get_all()
# Get a list of all Invoices using generator
for response in invoices.list_all_generator():
print(response)
# Get an Invoice by id
response = connection.invoices.get_by_id(<invoice_id>)
NOTE: Only Tenants, Invoices, Accounts, Contacts, Items and TrackingCategories API classes are defined in this SDK.
Integration Tests
- Install pytest package using pip as follows:
pip install pytest
- Create a 'test_credentials.json' file at project root directory and enter Xero OAuth2 authentication credentials of your Xero app.
{
"base_url": "<xero_base_url>",
"client_id": "<client_id>",
"client_secret": "<client_secret>",
"refresh_token": "<refresh_token>"
}
- Run integration tests as follows:
python -m pytest tests/integration
Metadata
Release files for xerosdk 0.14.4
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 |
|---|---|---|---|---|
| xerosdk-0.14.4.tar.gz | 11.4 kB | Without provenance | Details for xerosdk-0.14.4.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| xerosdk-0.14.4-py3-none-any.whl | Python 3 | none | any | Details for xerosdk-0.14.4-py3-none-any.whl |
Total release size: 28.4 kB
Release files / xerosdk-0.14.4.tar.gz
| Download URL | xerosdk-0.14.4.tar.gz |
|---|---|
| Size | 11.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
550ec06abca0d12333ba86fbb5d7f65c6606ac2dfd9aef08b3dae8b0be0cb12b
|
|
BLAKE2b-256 checksum How to use checksums |
1598dbe5a684a113d18aea5b184fa7578c5352f72a7efb9faedad9a1c2dc10ea
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.6
|
Release files / xerosdk-0.14.4-py3-none-any.whl
| Download URL | xerosdk-0.14.4-py3-none-any.whl |
|---|---|
| Size | 17.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
8964d66664d3a581dc2be96337675acd0ea179a0be0d674af8f1edc9f7c8bfee
|
|
BLAKE2b-256 checksum How to use checksums |
74c9168985a27dc2feda5a2fa03085865cead13d957ead9b2bde439be6139232
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.6
|
Security for xerosdk 0.14.4
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.