Skip to main content

Apache Airflow provider for Lexio Rent

PyPI License: MIT

airflow-provider-lexio connects Apache Airflow to the Lexio Rent API. Use it to move car and van rental data (fleet, rentals, customers, quotes, payments, maintenance) into a warehouse, a BI tool or an accounting system, on a schedule.

Lexio Rent is rental management software for professional car, van and two-wheeler rental companies: planning, contracts, check-in/check-out inspections, deposits and fleet maintenance.

Component What it does
LexioHook Builds an authenticated client from an Airflow connection. Every one of the 93 API operations is available through hook.client.
LexioOperator Calls any operation (resource + method) and pushes the JSON response to XCom.
LexioListOperator Exports a full list endpoint, following pagination, to XCom or to a JSON Lines file.
LexioEventSensor Waits for rental.created / rental.updated / rental.cancelled / rental.deleted events. The API has no webhooks, so the sensor reads the event feed and keeps its cursor in an Airflow Variable.

Works with Airflow 2.9+ and Airflow 3. Built on the lexio-rent Python client.

Installation

pip install airflow-provider-lexio

Connection

The Lexio API needs an API key, created in Lexio under Settings → Developer → API tokens. Keys start with lck_. API access is part of the Business plan, and there is no sandbox: test against a dedicated organization.

Create a connection of type Lexio Rent (id lexio_default by default):

Field Value
Password your lck_... API key
Host optional, overrides https://api.lexio.rent/api/external/v1

Or with an environment variable:

export AIRFLOW_CONN_LEXIO_DEFAULT='{"conn_type": "lexio", "password": "lck_..."}'

The Test button in the Airflow UI calls GET /organization and shows the organization name.

Usage

from lexio_provider.operators.lexio import LexioListOperator, LexioOperator
from lexio_provider.sensors.lexio import LexioEventSensor

# Whole active fleet, written as JSON Lines
export_fleet = LexioListOperator(
    task_id="export_fleet",
    resource="vehicles",
    filters={"is_archived": False},
    output_path="/data/lexio/vehicles_{{ ds_nodash }}.jsonl",
)

# One operation: GET /rentals/{rentalId}
get_rental = LexioOperator(
    task_id="get_rental",
    resource="rentals",
    method="get",
    args=["{{ params.rental_id }}"],
)

# Wait for new or changed rentals
new_rentals = LexioEventSensor(
    task_id="wait_for_rentals",
    event_types=["rental.created", "rental.updated"],
    mode="reschedule",
    poke_interval=60,
)

resource and method follow the lexio-rent client: vehicles.list, rentals.get, rentals.pick_up, customers.create, maintenance_records.list, events.list... Query filters are written in snake_case (is_archived=False is sent as isArchived=false); JSON bodies keep the API field names.

Inside a @task, use the hook directly:

from lexio_provider.hooks.lexio import LexioHook

hook = LexioHook()
for rental in hook.iter_all("rentals", status="RESERVED,IN_PROGRESS"):
    ...

A complete DAG (event sensor, then re-read of the changed rentals, then a fleet export) is in example_dags/lexio_rentals_sync.py.

How the event sensor works

  • First run: the feed starts at start="LATEST" (now), or "EARLIEST" (the last 29 days).
  • Each poke reads every page from the stored cursor and saves the new cursor in the Variable lexio_events_cursor__<conn id> (configurable with cursor_variable).
  • When at least one event matches, the sensor succeeds and returns the events through XCom. Events are thin (id, type, occurredAt, resource.id): read the rental again for its current state.
  • The cursor moves forward on every poke, so delivery to downstream tasks is at most once. Cursors expire after 30 days (410 CURSOR_EXPIRED); delete the Variable to start again.

Retries, idempotency and errors

The underlying client retries 429 and 5xx responses on reads and on idempotent writes, honouring Retry-After, and sends an Idempotency-Key on writes that need one, so an Airflow retry never books a vehicle twice. API errors are raised as typed exceptions (NotFoundError, ConflictError, RateLimitError...) with the Lexio code, detail and request_id, which show up in the task log.

Development

pip install -e ".[test]"
pytest

Tests use a mocked HTTP transport; they need no API key.

About

This provider is maintained by the team behind Lexio Rent, car rental management software. A typical pipeline reconciles rental deposits in the warehouse; for the paperwork side, Lexio also publishes a free security deposit refund statement generator (in French) that itemises deductions when a vehicle is returned.

MIT License.

Metadata

Release files for airflow-provider-lexio 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for airflow-provider-lexio 0.1.0
File Size Uploaded Provenance Actions
airflow_provider_lexio-0.1.0.tar.gz 10.8 kB Without provenance Details for airflow_provider_lexio-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for airflow-provider-lexio 0.1.0
File Interpreter ABI Platform Actions
airflow_provider_lexio-0.1.0-py3-none-any.whl Python 3 none any Details for airflow_provider_lexio-0.1.0-py3-none-any.whl

Total release size: 22.5 kB

Release files / airflow_provider_lexio-0.1.0.tar.gz

Download URL airflow_provider_lexio-0.1.0.tar.gz
Size 10.8 kB
Tags Source
SHA-256 checksum
How to use checksums
46dca3f481f0126c765d6a7e34be72f898d86d8456a621715e3285fce4a87db8
BLAKE2b-256 checksum
How to use checksums
8ea3e360a53eed38eadbcf78fa98b52ad98afb8ac7fe86c7eec62623bfb511ba
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.0

Release files / airflow_provider_lexio-0.1.0-py3-none-any.whl

Download URL airflow_provider_lexio-0.1.0-py3-none-any.whl
Size 11.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7337a8611ad66c47f597dde95f9d7df7561e838c6baed5c158afc91952074cf0
BLAKE2b-256 checksum
How to use checksums
43e85da2b5a0e1c3d780bad346f62de4e2a594eca902ef6c3a2db68039e9737c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.0

Security for airflow-provider-lexio 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page