# 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,lint]'
```
### Run tests
```bash
pytest
```
### Lint
```bash
ruff format
```
## 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/df/1e/87a16df00bfb4458364b92d7bf80fb8df33d23af86e88ae052fc02087d74/lago_python_client-1.33.1.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,lint]'\n```\n\n### Run tests\n\n```bash\npytest\n```\n\n### Lint\n\n```bash\nruff format\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.33.1",
"project_urls": {
"Homepage": "https://github.com/getlago/lago-python-client"
},
"split_keywords": [],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "fdbe99a0b4db6f17ef482b329a54b8f5f6590182d939cdb48ee33574d8057473",
"md5": "7861099cb7866a3d07f801198fdb7a8e",
"sha256": "f1d21ce589de0a2de526e7f592784e89db757d14a7962f5c06f2b45c1b4d8d76"
},
"downloads": -1,
"filename": "lago_python_client-1.33.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "7861099cb7866a3d07f801198fdb7a8e",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">3.6",
"size": 92264,
"upload_time": "2025-08-28T17:20:27",
"upload_time_iso_8601": "2025-08-28T17:20:27.178940Z",
"url": "https://files.pythonhosted.org/packages/fd/be/99a0b4db6f17ef482b329a54b8f5f6590182d939cdb48ee33574d8057473/lago_python_client-1.33.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "df1e87a16df00bfb4458364b92d7bf80fb8df33d23af86e88ae052fc02087d74",
"md5": "b7e2fb218fe3fadc4fa6a36326dd8344",
"sha256": "2dca4846650b79e9ce7b96875236fdbfc142b30d40fb76bdfafa58f3b327ac4f"
},
"downloads": -1,
"filename": "lago_python_client-1.33.1.tar.gz",
"has_sig": false,
"md5_digest": "b7e2fb218fe3fadc4fa6a36326dd8344",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">3.6",
"size": 43573,
"upload_time": "2025-08-28T17:20:28",
"upload_time_iso_8601": "2025-08-28T17:20:28.581814Z",
"url": "https://files.pythonhosted.org/packages/df/1e/87a16df00bfb4458364b92d7bf80fb8df33d23af86e88ae052fc02087d74/lago_python_client-1.33.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-08-28 17:20:28",
"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"
}