lago-python-client


Namelago-python-client JSON
Version 1.0.0 PyPI version JSON
download
home_pagehttps://github.com/getlago/lago-python-client
SummaryLago Python API Client
upload_time2024-03-11 15:32:23
maintainer
docs_urlNone
authorLovro Colic
requires_python>3.6
license
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Lago Python Client

This is a python wrapper for Lago API

[![PyPI version](https://badge.fury.io/py/lago-python-client.svg)](https://badge.fury.io/py/lago-python-client)
[![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://spdx.org/licenses/MIT.html)

## 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": "",
    "docs_url": null,
    "requires_python": ">3.6",
    "maintainer_email": "",
    "keywords": "",
    "author": "Lovro Colic",
    "author_email": "lovro@getlago.com",
    "download_url": "https://files.pythonhosted.org/packages/38/06/da24b9b304066eb06850c094db98119bd64d3059bcd760d400a93d0b5fe3/lago-python-client-1.0.0.tar.gz",
    "platform": null,
    "description": "# Lago Python Client\n\nThis is a python wrapper for Lago API\n\n[![PyPI version](https://badge.fury.io/py/lago-python-client.svg)](https://badge.fury.io/py/lago-python-client)\n[![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://spdx.org/licenses/MIT.html)\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": "",
    "summary": "Lago Python API Client",
    "version": "1.0.0",
    "project_urls": {
        "Homepage": "https://github.com/getlago/lago-python-client"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "2f2049c07d4902f1075f171956341a9f8d84f9d3f59177abbb4036aeee23812a",
                "md5": "81e0e48220599057338655f19dbcc628",
                "sha256": "c379880f6195f806c2cd280284133ca57bd3950ae28262f4522a86972bcc6847"
            },
            "downloads": -1,
            "filename": "lago_python_client-1.0.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "81e0e48220599057338655f19dbcc628",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">3.6",
            "size": 68237,
            "upload_time": "2024-03-11T15:32:21",
            "upload_time_iso_8601": "2024-03-11T15:32:21.080037Z",
            "url": "https://files.pythonhosted.org/packages/2f/20/49c07d4902f1075f171956341a9f8d84f9d3f59177abbb4036aeee23812a/lago_python_client-1.0.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "3806da24b9b304066eb06850c094db98119bd64d3059bcd760d400a93d0b5fe3",
                "md5": "adf7b19588c3d9c1a5bd3aae30bb563b",
                "sha256": "9bf23d7e2d09e113cac343384f6afd8b482d6e0c811275cfd1893e1d77fadbf1"
            },
            "downloads": -1,
            "filename": "lago-python-client-1.0.0.tar.gz",
            "has_sig": false,
            "md5_digest": "adf7b19588c3d9c1a5bd3aae30bb563b",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">3.6",
            "size": 29388,
            "upload_time": "2024-03-11T15:32:23",
            "upload_time_iso_8601": "2024-03-11T15:32:23.158499Z",
            "url": "https://files.pythonhosted.org/packages/38/06/da24b9b304066eb06850c094db98119bd64d3059bcd760d400a93d0b5fe3/lago-python-client-1.0.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-03-11 15:32:23",
    "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"
}
        
Elapsed time: 0.22534s