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.1.1.tar.gz (14.0 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.1.1-py3-none-any.whl (16.4 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for krossapy-0.1.1.tar.gz
Algorithm Hash digest
SHA256 4d3b6fa0bf5e4d3ba7d6825668adc2b26284af9cf1b31fe2667170911a3b9d0d
MD5 e98c7324bb51b0a48fae010d503c5ae2
BLAKE2b-256 b4c014dba15f670bdf316d4a1ecbe1fd33cd457dd47148787842dc80eb44bd2b

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for krossapy-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 edca83c8e148f07cacd6f56501e34736d2b74ccf20802ccb308020c31eb570d4
MD5 a8918250d8f8d8ef27a87e73316eccd0
BLAKE2b-256 902387b5988913929b1acb2bf63cbe256965494e1d9bffea58ade6ef7af7d0c0

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