Lago Python API Client
Project description
Lago Python Client
This is a python wrapper for Lago API
Installation
Install the lago-python-client via pip from PyPI:
$ pip install lago-python-client
Usage
Check the lago API reference
Development
Install the dependencies
pip install .
Run tests
python3 -m unittest tests
Documentation
The Lago documentation is available at doc.getlago.com.
Changelog
- #55 -- Error handling (
LagoApiError
)
Example, creating wallet:
try:
response = client.wallets().create(wallet)
except LagoApiError as error:
do_something(status=error.status_code)
Available properties:
>>> error.status_code
422
>>> error.detail
'Unprocessable Entity'
>>> error.headers
{'X-Frame-Options': 'SAMEORIGIN', 'X-XSS-Protection': '0', 'X-Content-Type-Options': 'nosniff', 'X-Download-Options': 'noopen', 'X-Permitted-Cross-Domain-Policies': 'none', 'Referrer-Policy': 'strict-origin-when-cross-origin', 'Content-Type': 'application/json; charset=utf-8', 'Cache-Control': 'no-cache', 'X-Request-Id': '613e7542-b29e-4224-bd19-a16dd1bfa62b', 'X-Runtime': '1.024304', 'Vary': 'Origin', 'Transfer-Encoding': 'chunked'}
>>> error.response
{'status': 422, 'error': 'Unprocessable Entity', 'code': 'validation_errors', 'error_details': {'customer': ['wallet_already_exists']}}
>>> error.response['error_details']['customer'][0]
'wallet_already_exists'
>>> error.url
'http://localhost:3000/api/v1/wallets'
Contributing
The contribution documentation is available here
License
Lago Python client is distributed under MIT license.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
lago-python-client-0.22.0.tar.gz
(16.0 kB
view hashes)
Built Distribution
Close
Hashes for lago-python-client-0.22.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | a0c26c2e9c181d1e6eeaa275647b895130a91372c56f7e3c882d597f71b2b45d |
|
MD5 | b1d4845b1e3e5a27ca3a9e65b7279167 |
|
BLAKE2b-256 | 40c9898bcf20c2ab76c76d66fb068a38c3301903da9f497ba0836b497578c7f9 |
Close
Hashes for lago_python_client-0.22.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d08ee4d0189d29c8dbd73cd77329d79db8700b2f7a71101504cc150e343e63f0 |
|
MD5 | ae8d0e61b5d00478ede5dc7d5ec32347 |
|
BLAKE2b-256 | 92b5e91f457b9273313581689e6be4949990f3243b519e9d9aedbd59c1e88573 |