Skip to main content

Unofficial API for KrossBooking

Project description

KrossBooking API Client

Unofficial KrossBooking API in Python. Requests are based on the official web interface (V2), data is extracted via static web scraping enabling easy programmatic access to it.

Usage Examples

Basic Setup

Note: This example is provided for demonstration purposes only. It retrieves every reservation without applying any filters, which may result in long fetch times. It is recommended to use appropriate filtering parameters to limit the dataset. See Filtering Reservations.

toggle example
from krossApy import KrossAPI

with KrossAPI("hotel_id") as api:
    api.login("username", "password")
    reservations = api.get_reservations()

print(reservations)

Output

Note: Default fields are used when none are specified. See Filtering Reservations Fields.

[
    {
        "code": "1234/5678",
        "channel": "Booking.com",
        "arrival": "01/01/2025",
        "departure": "02/01/2025",
        "guest_portal_link": "https://guestportallink",
        "email": "jhon@doe.com",
        "telephone": "1234567890"
    },
    ...
]

Filtering Reservations

toggle example
from krossApy import KrossAPI, Fields, build_filter, Reservations
from datetime import datetime

with KrossAPI("hotel_id") as api:

    api.login("username", "password")

    today = datetime.now().strftime("%d/%m/%Y")
    filter = build_filter(field=Fields.ARRIVAL, condition=">=", value=today)
    filters = [filter]

    reservations: Reservations = api.get_reservations(filters = filters)

print(reservations)

Filtering Reservations Fields

toggle example
from krossApy import KrossAPI, Fields, build_filter, Reservations

with KrossAPI("hotel_id") as api:
    api.login("username", "password")

    reservations: Reservations = api.get_reservations(
        fields = [
            Fields.CODE,
            Fields.TELEPHONE,
        ]
    )

print(reservations)

Output

[
    {
        "code": "1234/5678",
        "telephone": "1234567890"
    },
    ...
]

Reduced Output

To avoid repeating the field names in the output, you can use the simple_data attribute. simple_data is a dict with two keys: keys and values. keys contains the field names and values contains the values.

toggle example
from krossApy import KrossAPI, Fields, build_filter, Reservations
import json
with KrossAPI("hotel_id") as api:
    api.login("username", "password")

    reservations: Reservations = api.get_reservations(
        fields = [
            Fields.CODE,
            Fields.TELEPHONE,
        ]
    )

print(json.dumps(reservations.simple_data, indent=4))

Output

{
    "keys": ["code", "telephone"],
    "values": [
        ["1234/5678", "1234567890"],
        ["5678/1234", "0987654321"],
        ...
    ]
}

Further examples will be added in the future.

Installation

pip install krossApy

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

krossapy-0.0.6.tar.gz (13.5 kB view details)

Uploaded Source

Built Distribution

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

krossapy-0.0.6-py3-none-any.whl (15.3 kB view details)

Uploaded Python 3

File details

Details for the file krossapy-0.0.6.tar.gz.

File metadata

  • Download URL: krossapy-0.0.6.tar.gz
  • Upload date:
  • Size: 13.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.2

File hashes

Hashes for krossapy-0.0.6.tar.gz
Algorithm Hash digest
SHA256 1b9953e0cb218b73f294f68a551db0a9a9a3a20d297d1ce94498f6674b98ee8d
MD5 e810713e364a496b0c60649a6d415bed
BLAKE2b-256 4c6f7222918441e740d43613b40da648d892ee5c9e7767da521d4c11c04191f7

See more details on using hashes here.

File details

Details for the file krossapy-0.0.6-py3-none-any.whl.

File metadata

  • Download URL: krossapy-0.0.6-py3-none-any.whl
  • Upload date:
  • Size: 15.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.2

File hashes

Hashes for krossapy-0.0.6-py3-none-any.whl
Algorithm Hash digest
SHA256 2b60be2f48315e0257ce1931a9d982a8e4d59a75dbda95dacbfe8985e0ceb4dc
MD5 c6f30381ff1fe1561ebb38d205d71d82
BLAKE2b-256 9fc1fd556ff58588fc999b9a3c794d7d4d96db9b6566555b794358fb7509b5f0

See more details on using hashes here.

Supported by

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