# 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
``` python
from lago_python_client import Client
client = Client(api_key = 'key')
```
### Events
[Api reference](https://doc.getlago.com/docs/api/events)
``` python
from lago_python_client.models import Event
event = Event(
customer_id="5eb02857-a71e-4ea2-bcf9-57d8885990ba",
transaction_id="__UNIQUE_ID__",
code="123",
transaction_id="123",
timestamp=1650893379,
properties={"custom_field": "custom"}
)
client.events().create(event)
```
### Customers
[Api reference](https://doc.getlago.com/docs/api/customers/customer-object)
``` python
from lago_python_client.models import Customer
customer = Customer(
customer_id="5eb02857-a71e-4ea2-bcf9-57d8885990ba",
address_line1=None,
address_line2=None,
city=None,
country=None,
email="test@example.com",
legal_name=None,
legal_number=None,
logo_url=None,
name="test name",
phone=None,
state=None,
url=None,
vat_rate=None,
zipcode=None
)
client.customers().create(customer)
```
### Subscriptions
[Api reference](https://doc.getlago.com/docs/api/subscriptions/subscription-object)
``` python
from lago_python_client.models import Subscription
subscription = Subscription(
customer_id="5eb02857-a71e-4ea2-bcf9-57d8885990ba",
plan_code="code"
)
client.subscriptions().create(subscription)
params_delete = {
"customer_id": "5eb02857-a71e-4ea2-bcf9-57d8885990ba"
}
client.subscriptions().delete(params_delete)
```
### Applied coupons
[Api reference](https://doc.getlago.com/docs/api/applied_coupons/applied-coupon-object)
```python
from lago_python_client.models import AppliedCoupon
applied_coupon = AppliedCoupon(
customer_id="5eb02857-a71e-4ea2-bcf9-57d3a41bc6ba",
coupon_code="code",
amount_cents=123,
amount_currency="EUR"
)
client.applied_coupons().create(applied_coupon)
```
### Applied add-ons
[Api reference](https://doc.getlago.com/docs/api/applied_add_ons/applied-add-on-object)
```python
from lago_python_client.models import AppliedAddOn
applied_add_on = AppliedAddOn(
customer_id="5eb02857-a71e-4ea2-bcf9-57d3a41bc6ba",
add_on_code="code",
amount_cents=123,
amount_currency="EUR"
)
client.applied_add_ons().create(applied_add_on)
```
## Development
### Install the dependencies
```bash
pip install .
```
### Run tests
```bash
python3 -m unittest tests
```
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/32/60/c5810b2e7c8b48c16461823e75b33e51583a52c4228110e51c74a1796d21/lago-python-client-0.1.2.tar.gz",
"platform": null,
"description": "# Lago Python Client\n\nThis is a python wrapper for Lago API\n\n## Installation\n\nInstall the lago-python-client via pip from PyPI:\n\n $ pip install lago-python-client\n\n## Usage\n\n``` python\nfrom lago_python_client import Client\n\nclient = Client(api_key = 'key')\n```\n\n### Events\n[Api reference](https://doc.getlago.com/docs/api/events)\n\n``` python\nfrom lago_python_client.models import Event\n\nevent = Event(\n customer_id=\"5eb02857-a71e-4ea2-bcf9-57d8885990ba\",\n transaction_id=\"__UNIQUE_ID__\",\n code=\"123\",\n transaction_id=\"123\",\n timestamp=1650893379,\n properties={\"custom_field\": \"custom\"}\n)\n\nclient.events().create(event)\n```\n\n### Customers\n[Api reference](https://doc.getlago.com/docs/api/customers/customer-object)\n\n``` python\nfrom lago_python_client.models import Customer\n\ncustomer = Customer(\n customer_id=\"5eb02857-a71e-4ea2-bcf9-57d8885990ba\",\n address_line1=None,\n address_line2=None,\n city=None,\n country=None,\n email=\"test@example.com\",\n legal_name=None,\n legal_number=None,\n logo_url=None,\n name=\"test name\",\n phone=None,\n state=None,\n url=None,\n vat_rate=None,\n zipcode=None\n)\nclient.customers().create(customer)\n```\n\n### Subscriptions\n[Api reference](https://doc.getlago.com/docs/api/subscriptions/subscription-object)\n\n``` python\nfrom lago_python_client.models import Subscription\n\nsubscription = Subscription(\n customer_id=\"5eb02857-a71e-4ea2-bcf9-57d8885990ba\",\n plan_code=\"code\"\n)\nclient.subscriptions().create(subscription)\n\nparams_delete = {\n \"customer_id\": \"5eb02857-a71e-4ea2-bcf9-57d8885990ba\"\n}\nclient.subscriptions().delete(params_delete)\n```\n\n### Applied coupons\n[Api reference](https://doc.getlago.com/docs/api/applied_coupons/applied-coupon-object)\n\n```python\nfrom lago_python_client.models import AppliedCoupon\n\napplied_coupon = AppliedCoupon(\n customer_id=\"5eb02857-a71e-4ea2-bcf9-57d3a41bc6ba\",\n coupon_code=\"code\",\n amount_cents=123,\n amount_currency=\"EUR\"\n)\n\nclient.applied_coupons().create(applied_coupon)\n```\n\n### Applied add-ons\n[Api reference](https://doc.getlago.com/docs/api/applied_add_ons/applied-add-on-object)\n\n```python\nfrom lago_python_client.models import AppliedAddOn\n\napplied_add_on = AppliedAddOn(\n customer_id=\"5eb02857-a71e-4ea2-bcf9-57d3a41bc6ba\",\n add_on_code=\"code\",\n amount_cents=123,\n amount_currency=\"EUR\"\n)\n\nclient.applied_add_ons().create(applied_add_on)\n```\n\n\n## Development\n\n### Install the dependencies\n\n```bash\npip install .\n```\n\n### Run tests\n\n```bash\npython3 -m unittest tests\n```\n",
"bugtrack_url": null,
"license": "",
"summary": "Lago Python API Client",
"version": "0.1.2",
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"md5": "e253fbc5e0c3380460f5d982d8725be8",
"sha256": "aa9c49643a85caf2a22ae51e31cf61f6c84da1592915fc4aaade1435df8b5886"
},
"downloads": -1,
"filename": "lago_python_client-0.1.2-py3-none-any.whl",
"has_sig": false,
"md5_digest": "e253fbc5e0c3380460f5d982d8725be8",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.6",
"size": 14647,
"upload_time": "2022-05-30T11:12:56",
"upload_time_iso_8601": "2022-05-30T11:12:56.572896Z",
"url": "https://files.pythonhosted.org/packages/6e/5b/4874f7a6a7de55f897bdb84b26466b358a91c415efce5711c50fdb5c6a80/lago_python_client-0.1.2-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"md5": "70d3f9a7f2cf0ab1512118b577782e6e",
"sha256": "4835a0a203e7275db3961dd165975898d415e79d4ece1ef4b1648055d6fa9fcd"
},
"downloads": -1,
"filename": "lago-python-client-0.1.2.tar.gz",
"has_sig": false,
"md5_digest": "70d3f9a7f2cf0ab1512118b577782e6e",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.6",
"size": 7549,
"upload_time": "2022-05-30T11:13:00",
"upload_time_iso_8601": "2022-05-30T11:13:00.974286Z",
"url": "https://files.pythonhosted.org/packages/32/60/c5810b2e7c8b48c16461823e75b33e51583a52c4228110e51c74a1796d21/lago-python-client-0.1.2.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2022-05-30 11:13:00",
"github": true,
"gitlab": false,
"bitbucket": false,
"github_user": "getlago",
"github_project": "lago-python-client",
"lcname": "lago-python-client"
}