# Lago Python Client
This is a python wrapper for Lago API
[](https://badge.fury.io/py/lago-python-client)
[](https://spdx.org/licenses/MIT.html)
## Current Releases
| Project | Release Badge |
|--------------------|-----------------------------------------------------------------------------------------------------|
| **Lago** | [](https://github.com/getlago/lago/releases) |
| **Lago Python Client** | [](https://github.com/getlago/lago-python-client/releases) |
## Installation
Install the lago-python-client via pip from PyPI:
$ python -m pip install "lago-python-client"
(Alternative) Install the lago-python-client via [poetry](https://python-poetry.org/) from PyPI:
$ poetry add "lago-python-client"
## Usage
Check the [lago API reference](https://doc.getlago.com/docs/api/intro)
## Development
### Install the dependencies
```bash
python -m pip install --upgrade pip setuptools wheel
python -m pip install .[test]
```
### Run tests
```bash
pytest
```
## Documentation
The Lago documentation is available at [doc.getlago.com](https://doc.getlago.com/docs/api/intro).
## Changelog
* [#55](https://github.com/getlago/lago-python-client/pull/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](https://github.com/getlago/lago-python-client/blob/main/CONTRIBUTING.md)
## License
Lago Python client is distributed under [MIT license](LICENSE).
Raw data
{
"_id": null,
"home_page": "https://github.com/getlago/lago-python-client",
"name": "lago-python-client",
"maintainer": null,
"docs_url": null,
"requires_python": ">3.6",
"maintainer_email": null,
"keywords": null,
"author": "Lovro Colic",
"author_email": "lovro@getlago.com",
"download_url": "https://files.pythonhosted.org/packages/6b/be/8aac7ce05455ef482ec828622a3fc7d9b8ce3bc55fe280e02cdae075ceea/lago_python_client-1.18.0.tar.gz",
"platform": null,
"description": "# Lago Python Client\n\nThis is a python wrapper for Lago API\n\n[](https://badge.fury.io/py/lago-python-client)\n[](https://spdx.org/licenses/MIT.html)\n\n## Current Releases\n\n| Project | Release Badge |\n|--------------------|-----------------------------------------------------------------------------------------------------|\n| **Lago** | [](https://github.com/getlago/lago/releases) |\n| **Lago Python Client** | [](https://github.com/getlago/lago-python-client/releases) |\n\n## Installation\n\nInstall the lago-python-client via pip from PyPI:\n\n $ python -m pip install \"lago-python-client\"\n\n(Alternative) Install the lago-python-client via [poetry](https://python-poetry.org/) from PyPI:\n\n $ poetry add \"lago-python-client\"\n\n## Usage\n\nCheck the [lago API reference](https://doc.getlago.com/docs/api/intro)\n\n## Development\n\n### Install the dependencies\n\n```bash\npython -m pip install --upgrade pip setuptools wheel\npython -m pip install .[test]\n```\n\n### Run tests\n\n```bash\npytest\n```\n\n## Documentation\n\nThe Lago documentation is available at [doc.getlago.com](https://doc.getlago.com/docs/api/intro).\n\n## Changelog\n\n* [#55](https://github.com/getlago/lago-python-client/pull/55) -- Error handling (`LagoApiError`)\n\n\nExample, creating wallet:\n\n```\ntry:\n response = client.wallets().create(wallet)\nexcept LagoApiError as error:\n do_something(status=error.status_code)\n```\n### Available properties:\n```\n>>> error.status_code\n422\n\n>>> error.detail\n'Unprocessable Entity'\n\n>>> error.headers\n{'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'}\n\n>>> error.response\n{'status': 422, 'error': 'Unprocessable Entity', 'code': 'validation_errors', 'error_details': {'customer': ['wallet_already_exists']}}\n\n>>> error.response['error_details']['customer'][0]\n'wallet_already_exists'\n\n\n>>> error.url\n'http://localhost:3000/api/v1/wallets'\n```\n\n\n## Contributing\n\nThe contribution documentation is available [here](https://github.com/getlago/lago-python-client/blob/main/CONTRIBUTING.md)\n\n## License\n\nLago Python client is distributed under [MIT license](LICENSE).\n",
"bugtrack_url": null,
"license": null,
"summary": "Lago Python API Client",
"version": "1.18.0",
"project_urls": {
"Homepage": "https://github.com/getlago/lago-python-client"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "8beb7488ca42cf38c358e84b04900a9b7c2b1b0db054c1bb26f3206475eb3b46",
"md5": "2e07a343fc83cd15126038d7c185d46c",
"sha256": "35346fd00c3eb68436279613dcfae81cf69d5a75aa345f72008a817d7c204ba0"
},
"downloads": -1,
"filename": "lago_python_client-1.18.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "2e07a343fc83cd15126038d7c185d46c",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">3.6",
"size": 76269,
"upload_time": "2025-01-14T16:00:13",
"upload_time_iso_8601": "2025-01-14T16:00:13.679903Z",
"url": "https://files.pythonhosted.org/packages/8b/eb/7488ca42cf38c358e84b04900a9b7c2b1b0db054c1bb26f3206475eb3b46/lago_python_client-1.18.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "6bbe8aac7ce05455ef482ec828622a3fc7d9b8ce3bc55fe280e02cdae075ceea",
"md5": "d16800705fb5c50f579a577b5230a9cd",
"sha256": "56bcea56399c9b71073b0f96cd75b52a71c145aca48f81bcfa5312ae0820396c"
},
"downloads": -1,
"filename": "lago_python_client-1.18.0.tar.gz",
"has_sig": false,
"md5_digest": "d16800705fb5c50f579a577b5230a9cd",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">3.6",
"size": 37381,
"upload_time": "2025-01-14T16:00:15",
"upload_time_iso_8601": "2025-01-14T16:00:15.768106Z",
"url": "https://files.pythonhosted.org/packages/6b/be/8aac7ce05455ef482ec828622a3fc7d9b8ce3bc55fe280e02cdae075ceea/lago_python_client-1.18.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-01-14 16:00:15",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "getlago",
"github_project": "lago-python-client",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "lago-python-client"
}