bookalimo


Namebookalimo JSON
Version 0.1.5 PyPI version JSON
download
home_pageNone
SummaryPython wrapper for the Book-A-Limo API
upload_time2025-09-04 23:31:46
maintainerNone
docs_urlNone
authorNone
requires_python>=3.9
licenseMIT
keywords bookalimo api transportation booking
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Book-A-Limo Python SDK

[![PyPI version](https://badge.fury.io/py/bookalimo.svg)](https://badge.fury.io/py/bookalimo)
[![Python Support](https://img.shields.io/pypi/pyversions/bookalimo.svg)](https://pypi.org/project/bookalimo/)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
[![Code style: ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json)](https://github.com/astral-sh/ruff)

A modern, async Python wrapper for the Book-A-Limo API with full type support. Built on top of `httpx` and `pydantic`.

## Table of Contents

- [Book-A-Limo Python SDK](#book-a-limo-python-sdk)
  - [Table of Contents](#table-of-contents)
  - [Features](#features)
  - [Requirements](#requirements)
  - [Installation](#installation)
  - [Quick Start](#quick-start)
  - [Authentication](#authentication)
  - [Core Operations](#core-operations)
    - [Get Pricing](#get-pricing)
    - [Book a Reservation](#book-a-reservation)
  - [Location Builders](#location-builders)
    - [Airport Locations](#airport-locations)
    - [Address Locations](#address-locations)
    - [Stops](#stops)
  - [Advanced](#advanced)
    - [Using Account Info (Travel Agents)](#using-account-info-travel-agents)
    - [Edit / Cancel a Reservation](#edit--cancel-a-reservation)
  - [Error Handling](#error-handling)
  - [Logging](#logging)
    - [Enable Debug Logging](#enable-debug-logging)
    - [Custom Logging](#custom-logging)
    - [Security](#security)
    - [Disable Logging](#disable-logging)
  - [Development](#development)
  - [Security Notes](#security-notes)
  - [License](#license)
  - [Changelog](#changelog)

## Features

* **Asynchronous**
* **Fully Typed** for requests & responses
* **Input validation** including airports and addresses.
* **Clean, minimal interface** for each API operation
* **Custom exceptions & error handling**
* **Tests and examples**

## Requirements

* Python **3.9+** (`pyproject.toml` sets `requires-python = ">=3.9"`)
* An async event loop (examples use `asyncio`)
* Time strings use **`MM/dd/yyyy hh:mm tt`** (e.g., `09/05/2025 12:44 AM`)

## Installation

```bash
pip install bookalimo
```

## Quick Start

```python
import asyncio

from bookalimo import (
    BookALimo,
    create_credentials,
    create_airport_location,
    create_address_location,
)
from bookalimo.models import RateType

async def main():
    # For Travel Agents (customers: pass is_customer=True)
    credentials = create_credentials("TA10007", "your_password")

    async with BookALimo(credentials) as client:
        # Build locations
        pickup = create_airport_location("JFK", "New York")
        dropoff = create_address_location("53 East 34th Street, Manhattan")

        prices = await client.get_prices(
            rate_type=RateType.P2P,
            date_time="09/05/2025 12:44 AM",
            pickup=pickup,
            dropoff=dropoff,
            passengers=2,
            luggage=3,
        )

        print(f"Available cars: {len(prices.prices)}")
        for price in prices.prices:
            print(f"- {price.car_description}: ${price.price}")

if __name__ == "__main__":
    asyncio.run(main())
```

## Authentication

```python
from bookalimo import create_credentials

# Travel Agents
ta_creds = create_credentials("TA10007", "password", is_customer=False)

# Customers
cust_creds = create_credentials("customer@email.com", "password", is_customer=True)
```

## Core Operations

```python
# List Reservations
reservations = await client.list_reservations(is_archive=False)

# Get Reservation Details
details = await client.get_reservation("5452773")
```

### Get Pricing

```python
from bookalimo.models import RateType

prices = await client.get_prices(
    rate_type=RateType.P2P,
    date_time="09/05/2025 12:44 AM",
    pickup=pickup,            # Location
    dropoff=dropoff,          # Location
    passengers=2,
    luggage=3,
    # Optional kwargs:
    # hours=2, stops=[...], account=..., passenger=..., rewards=[...],
    # car_class_code="SD", pets=0, car_seats=0, boosters=0, infants=0,
    # customer_comment="..."
)
```

### Book a Reservation

```python
from bookalimo import create_credit_card, create_passenger
from bookalimo.models import CardHolderType

# Optionally set details first (select car class, add passenger, etc.)
details = await client.set_details(
    token=prices.token,
    car_class_code="SD",
    passenger=create_passenger("John", "Smith", "+19173334455"),
)

# Book with credit card
card = create_credit_card(
    number="4111 1111 1111 1111",  # test PAN
    card_holder="John Smith",
    holder_type=CardHolderType.PERSONAL,
    expiration="01/28",
    cvv="123",
    zip_code="10016",
)

booking = await client.book(token=prices.token, credit_card=card)
print(f"Booked! Confirmation: {booking.reservation_id}")

# Or charge account
booking = await client.book(token=prices.token, method="charge")
```

## Location Builders

### Airport Locations

```python
from bookalimo import create_airport_location

pickup = create_airport_location(
    iata_code="JFK",
    city_name="New York",
    airline_code="UA",
    flight_number="UA1234",
    terminal="7",
)
```

### Address Locations

```python
from bookalimo import create_address_location

dropoff = create_address_location(
    address="53 East 34th Street, Manhattan",
    zip_code="10016",
)
```

### Stops

```python
from bookalimo import create_stop

stops = [
    create_stop("Brooklyn Bridge", is_en_route=False),
    create_stop("Empire State Building", is_en_route=True),
]
```

## Advanced

### Using Account Info (Travel Agents)

```python
from bookalimo.models import Account

account = Account(
    id="TA10007",
    department="Sales",
    booker_first_name="Jane",
    booker_last_name="Agent",
    booker_email="jane@agency.com",
    booker_phone="+19173334455",
)

prices = await client.get_prices(
    # ... required args
    account=account,
)
```

### Edit / Cancel a Reservation

```python
# Edit (e.g., add note or change passengers). Omitting fields leaves them unchanged.
edit_result = await client.edit_reservation(
    confirmation="5452773",
    is_cancel_request=False,
    passengers=3,
    other="Gate pickup",
)

# Cancel
cancel_result = await client.edit_reservation(
    confirmation="5452773",
    is_cancel_request=True,
)
```

## Error Handling

```python
from bookalimo.exceptions import BookALimoError

try:
    reservations = await client.list_reservations()
except BookALimoError as e:
    print(f"API Error: {e}")
    print(f"Status Code: {e.status_code}")
    print(f"Response Data: {e.response_data}")
```

## Logging

By default, no log messages appear. Enable logging for debugging or monitoring.

### Enable Debug Logging

```python
import bookalimo

bookalimo.enable_debug_logging()

async with bookalimo.BookALimo(credentials) as client:
    reservations = await client.list_reservations()  # Shows API calls, timing, etc.
```

Or use the environment variable:
```bash
export BOOKALIMO_LOG_LEVEL=DEBUG
```

### Custom Logging

```python
import logging
import bookalimo

logging.basicConfig(level=logging.INFO)
bookalimo.get_logger().setLevel(logging.WARNING)  # Production setting
```

### Security

Sensitive data is automatically redacted in logs:
- Passwords, tokens, CVV codes: `******`
- API keys: `abc123…89` (first 6, last 2 chars)
- Emails: `j***@example.com`
- Credit cards: `**** **** **** 1234`

### Disable Logging

```python
bookalimo.disable_debug_logging()
```

## Development

```bash
# Clone & setup
git clone https://github.com/yourusername/bookalimo-python.git
cd bookalimo-python
pip install -e ".[dev]"
pre-commit install

# Run tests
pytest
pytest --cov=bookalimo --cov-report=html

# Docs (MkDocs)
mkdocs serve
```

## Security Notes

* Never log raw passwords or credit card numbers.
* Store credentials securely (e.g., environment variables, secrets managers).

## License

This project is licensed under the MIT License — see [`LICENSE`](LICENSE).

## Changelog

See [`CHANGELOG.md`](CHANGELOG.md) for release history.

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "bookalimo",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.9",
    "maintainer_email": "Jonathan Oren <jonathan@bookalimo.com>",
    "keywords": "bookalimo, api, transportation, booking",
    "author": null,
    "author_email": "Jonathan Oren <jonathan@bookalimo.com>",
    "download_url": "https://files.pythonhosted.org/packages/3d/e2/c8411e2b09881658d495a57c4885f11b7a861e4b176383c5a13127d039af/bookalimo-0.1.5.tar.gz",
    "platform": null,
    "description": "# Book-A-Limo Python SDK\n\n[![PyPI version](https://badge.fury.io/py/bookalimo.svg)](https://badge.fury.io/py/bookalimo)\n[![Python Support](https://img.shields.io/pypi/pyversions/bookalimo.svg)](https://pypi.org/project/bookalimo/)\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)\n[![Code style: ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json)](https://github.com/astral-sh/ruff)\n\nA modern, async Python wrapper for the Book-A-Limo API with full type support. Built on top of `httpx` and `pydantic`.\n\n## Table of Contents\n\n- [Book-A-Limo Python SDK](#book-a-limo-python-sdk)\n  - [Table of Contents](#table-of-contents)\n  - [Features](#features)\n  - [Requirements](#requirements)\n  - [Installation](#installation)\n  - [Quick Start](#quick-start)\n  - [Authentication](#authentication)\n  - [Core Operations](#core-operations)\n    - [Get Pricing](#get-pricing)\n    - [Book a Reservation](#book-a-reservation)\n  - [Location Builders](#location-builders)\n    - [Airport Locations](#airport-locations)\n    - [Address Locations](#address-locations)\n    - [Stops](#stops)\n  - [Advanced](#advanced)\n    - [Using Account Info (Travel Agents)](#using-account-info-travel-agents)\n    - [Edit / Cancel a Reservation](#edit--cancel-a-reservation)\n  - [Error Handling](#error-handling)\n  - [Logging](#logging)\n    - [Enable Debug Logging](#enable-debug-logging)\n    - [Custom Logging](#custom-logging)\n    - [Security](#security)\n    - [Disable Logging](#disable-logging)\n  - [Development](#development)\n  - [Security Notes](#security-notes)\n  - [License](#license)\n  - [Changelog](#changelog)\n\n## Features\n\n* **Asynchronous**\n* **Fully Typed** for requests & responses\n* **Input validation** including airports and addresses.\n* **Clean, minimal interface** for each API operation\n* **Custom exceptions & error handling**\n* **Tests and examples**\n\n## Requirements\n\n* Python **3.9+** (`pyproject.toml` sets `requires-python = \">=3.9\"`)\n* An async event loop (examples use `asyncio`)\n* Time strings use **`MM/dd/yyyy hh:mm tt`** (e.g., `09/05/2025 12:44 AM`)\n\n## Installation\n\n```bash\npip install bookalimo\n```\n\n## Quick Start\n\n```python\nimport asyncio\n\nfrom bookalimo import (\n    BookALimo,\n    create_credentials,\n    create_airport_location,\n    create_address_location,\n)\nfrom bookalimo.models import RateType\n\nasync def main():\n    # For Travel Agents (customers: pass is_customer=True)\n    credentials = create_credentials(\"TA10007\", \"your_password\")\n\n    async with BookALimo(credentials) as client:\n        # Build locations\n        pickup = create_airport_location(\"JFK\", \"New York\")\n        dropoff = create_address_location(\"53 East 34th Street, Manhattan\")\n\n        prices = await client.get_prices(\n            rate_type=RateType.P2P,\n            date_time=\"09/05/2025 12:44 AM\",\n            pickup=pickup,\n            dropoff=dropoff,\n            passengers=2,\n            luggage=3,\n        )\n\n        print(f\"Available cars: {len(prices.prices)}\")\n        for price in prices.prices:\n            print(f\"- {price.car_description}: ${price.price}\")\n\nif __name__ == \"__main__\":\n    asyncio.run(main())\n```\n\n## Authentication\n\n```python\nfrom bookalimo import create_credentials\n\n# Travel Agents\nta_creds = create_credentials(\"TA10007\", \"password\", is_customer=False)\n\n# Customers\ncust_creds = create_credentials(\"customer@email.com\", \"password\", is_customer=True)\n```\n\n## Core Operations\n\n```python\n# List Reservations\nreservations = await client.list_reservations(is_archive=False)\n\n# Get Reservation Details\ndetails = await client.get_reservation(\"5452773\")\n```\n\n### Get Pricing\n\n```python\nfrom bookalimo.models import RateType\n\nprices = await client.get_prices(\n    rate_type=RateType.P2P,\n    date_time=\"09/05/2025 12:44 AM\",\n    pickup=pickup,            # Location\n    dropoff=dropoff,          # Location\n    passengers=2,\n    luggage=3,\n    # Optional kwargs:\n    # hours=2, stops=[...], account=..., passenger=..., rewards=[...],\n    # car_class_code=\"SD\", pets=0, car_seats=0, boosters=0, infants=0,\n    # customer_comment=\"...\"\n)\n```\n\n### Book a Reservation\n\n```python\nfrom bookalimo import create_credit_card, create_passenger\nfrom bookalimo.models import CardHolderType\n\n# Optionally set details first (select car class, add passenger, etc.)\ndetails = await client.set_details(\n    token=prices.token,\n    car_class_code=\"SD\",\n    passenger=create_passenger(\"John\", \"Smith\", \"+19173334455\"),\n)\n\n# Book with credit card\ncard = create_credit_card(\n    number=\"4111 1111 1111 1111\",  # test PAN\n    card_holder=\"John Smith\",\n    holder_type=CardHolderType.PERSONAL,\n    expiration=\"01/28\",\n    cvv=\"123\",\n    zip_code=\"10016\",\n)\n\nbooking = await client.book(token=prices.token, credit_card=card)\nprint(f\"Booked! Confirmation: {booking.reservation_id}\")\n\n# Or charge account\nbooking = await client.book(token=prices.token, method=\"charge\")\n```\n\n## Location Builders\n\n### Airport Locations\n\n```python\nfrom bookalimo import create_airport_location\n\npickup = create_airport_location(\n    iata_code=\"JFK\",\n    city_name=\"New York\",\n    airline_code=\"UA\",\n    flight_number=\"UA1234\",\n    terminal=\"7\",\n)\n```\n\n### Address Locations\n\n```python\nfrom bookalimo import create_address_location\n\ndropoff = create_address_location(\n    address=\"53 East 34th Street, Manhattan\",\n    zip_code=\"10016\",\n)\n```\n\n### Stops\n\n```python\nfrom bookalimo import create_stop\n\nstops = [\n    create_stop(\"Brooklyn Bridge\", is_en_route=False),\n    create_stop(\"Empire State Building\", is_en_route=True),\n]\n```\n\n## Advanced\n\n### Using Account Info (Travel Agents)\n\n```python\nfrom bookalimo.models import Account\n\naccount = Account(\n    id=\"TA10007\",\n    department=\"Sales\",\n    booker_first_name=\"Jane\",\n    booker_last_name=\"Agent\",\n    booker_email=\"jane@agency.com\",\n    booker_phone=\"+19173334455\",\n)\n\nprices = await client.get_prices(\n    # ... required args\n    account=account,\n)\n```\n\n### Edit / Cancel a Reservation\n\n```python\n# Edit (e.g., add note or change passengers). Omitting fields leaves them unchanged.\nedit_result = await client.edit_reservation(\n    confirmation=\"5452773\",\n    is_cancel_request=False,\n    passengers=3,\n    other=\"Gate pickup\",\n)\n\n# Cancel\ncancel_result = await client.edit_reservation(\n    confirmation=\"5452773\",\n    is_cancel_request=True,\n)\n```\n\n## Error Handling\n\n```python\nfrom bookalimo.exceptions import BookALimoError\n\ntry:\n    reservations = await client.list_reservations()\nexcept BookALimoError as e:\n    print(f\"API Error: {e}\")\n    print(f\"Status Code: {e.status_code}\")\n    print(f\"Response Data: {e.response_data}\")\n```\n\n## Logging\n\nBy default, no log messages appear. Enable logging for debugging or monitoring.\n\n### Enable Debug Logging\n\n```python\nimport bookalimo\n\nbookalimo.enable_debug_logging()\n\nasync with bookalimo.BookALimo(credentials) as client:\n    reservations = await client.list_reservations()  # Shows API calls, timing, etc.\n```\n\nOr use the environment variable:\n```bash\nexport BOOKALIMO_LOG_LEVEL=DEBUG\n```\n\n### Custom Logging\n\n```python\nimport logging\nimport bookalimo\n\nlogging.basicConfig(level=logging.INFO)\nbookalimo.get_logger().setLevel(logging.WARNING)  # Production setting\n```\n\n### Security\n\nSensitive data is automatically redacted in logs:\n- Passwords, tokens, CVV codes: `******`\n- API keys: `abc123\u202689` (first 6, last 2 chars)\n- Emails: `j***@example.com`\n- Credit cards: `**** **** **** 1234`\n\n### Disable Logging\n\n```python\nbookalimo.disable_debug_logging()\n```\n\n## Development\n\n```bash\n# Clone & setup\ngit clone https://github.com/yourusername/bookalimo-python.git\ncd bookalimo-python\npip install -e \".[dev]\"\npre-commit install\n\n# Run tests\npytest\npytest --cov=bookalimo --cov-report=html\n\n# Docs (MkDocs)\nmkdocs serve\n```\n\n## Security Notes\n\n* Never log raw passwords or credit card numbers.\n* Store credentials securely (e.g., environment variables, secrets managers).\n\n## License\n\nThis project is licensed under the MIT License \u2014 see [`LICENSE`](LICENSE).\n\n## Changelog\n\nSee [`CHANGELOG.md`](CHANGELOG.md) for release history.\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Python wrapper for the Book-A-Limo API",
    "version": "0.1.5",
    "project_urls": {
        "Changelog": "https://github.com/yourusername/bookalimo-python/blob/main/CHANGELOG.md",
        "Documentation": "https://yourusername.github.io/bookalimo-python",
        "Homepage": "https://github.com/yourusername/bookalimo-python",
        "Issues": "https://github.com/yourusername/bookalimo-python/issues",
        "Repository": "https://github.com/yourusername/bookalimo-python"
    },
    "split_keywords": [
        "bookalimo",
        " api",
        " transportation",
        " booking"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "385d0417da0dafc6af88c6c6d9200baf87c47cbdd6102673cf11c5ad70e567dd",
                "md5": "749f55c474de5075c12290539b8abb0c",
                "sha256": "1066fa45eae93fc9a41dee5c0d46748dd887e0de77bfd26ff9b8276d6df1ba2f"
            },
            "downloads": -1,
            "filename": "bookalimo-0.1.5-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "749f55c474de5075c12290539b8abb0c",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.9",
            "size": 19549,
            "upload_time": "2025-09-04T23:31:44",
            "upload_time_iso_8601": "2025-09-04T23:31:44.916726Z",
            "url": "https://files.pythonhosted.org/packages/38/5d/0417da0dafc6af88c6c6d9200baf87c47cbdd6102673cf11c5ad70e567dd/bookalimo-0.1.5-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "3de2c8411e2b09881658d495a57c4885f11b7a861e4b176383c5a13127d039af",
                "md5": "7d1f43f2a9f0b9f2b6130ce3836adc66",
                "sha256": "7eb2b80ca47c4201d0ab080e0e5b39a2fc5b58d283af1305f8814ef8a60d0365"
            },
            "downloads": -1,
            "filename": "bookalimo-0.1.5.tar.gz",
            "has_sig": false,
            "md5_digest": "7d1f43f2a9f0b9f2b6130ce3836adc66",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.9",
            "size": 22858,
            "upload_time": "2025-09-04T23:31:46",
            "upload_time_iso_8601": "2025-09-04T23:31:46.266953Z",
            "url": "https://files.pythonhosted.org/packages/3d/e2/c8411e2b09881658d495a57c4885f11b7a861e4b176383c5a13127d039af/bookalimo-0.1.5.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-09-04 23:31:46",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "yourusername",
    "github_project": "bookalimo-python",
    "github_not_found": true,
    "lcname": "bookalimo"
}
        
Elapsed time: 0.59551s