Skip to main content

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

from lago_python_client import Client

client = Client(api_key = 'key')

Events

Api reference

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

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

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

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

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

pip install .

Run tests

python3 -m unittest tests

Documentation

The Lago documentation is available at doc.getlago.com.

Contributing

The contribution documentation is available here

License

Lago Python client is distributed under AGPL-3.0.

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.1.3.tar.gz (19.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

lago_python_client-0.1.3-py3-none-any.whl (25.9 kB view details)

Uploaded Python 3

File details

Details for the file lago-python-client-0.1.3.tar.gz.

File metadata

  • Download URL: lago-python-client-0.1.3.tar.gz
  • Upload date:
  • Size: 19.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.0 CPython/3.10.4

File hashes

Hashes for lago-python-client-0.1.3.tar.gz
Algorithm Hash digest
SHA256 619253863658fd5c2ac036f74fa28cedf03a53d0ee2afc3b6a638cb2d37c2f10
MD5 c651cece4cf8b78f4603e69147137796
BLAKE2b-256 e459ad65a8c2973b56d6fd919f3ec49c61b4569e3ebed36653f24a3a59ff3e28

See more details on using hashes here.

File details

Details for the file lago_python_client-0.1.3-py3-none-any.whl.

File metadata

File hashes

Hashes for lago_python_client-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 47dbfd66f8662c23f134f125281d77869ac9ae65a2a905888dacb03d86e4b5c6
MD5 6f426eeaf147bdd2b6b5f2a0501b73ba
BLAKE2b-256 72d4e0969947a295ee3ef0821637716b04ebd55229b8ddd58d54b5ab06aee8e2

See more details on using hashes here.

Release history Release notifications | RSS feed

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page