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.4.tar.gz (14.3 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.4-py3-none-any.whl (16.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: krossapy-0.1.4.tar.gz
  • Upload date:
  • Size: 14.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.9

File hashes

Hashes for krossapy-0.1.4.tar.gz
Algorithm Hash digest
SHA256 59bc350edad0b182f96ec6b661225755948fe653b3480150b975815918eb811d
MD5 1967f1e98b923bf4287d2c2c6f680c6c
BLAKE2b-256 116bb95a6ddf182ef345989300ebac1c18309a72a7205c82d5b0f796d4a15acd

See more details on using hashes here.

File details

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

File metadata

  • Download URL: krossapy-0.1.4-py3-none-any.whl
  • Upload date:
  • Size: 16.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.9

File hashes

Hashes for krossapy-0.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 8873cf32129020dad163fea19ba31e3e144f04e93172cdce02874c35480d5b60
MD5 34e1bcb14da106bfaebc544c8483031b
BLAKE2b-256 a4383ec9aef3669de658e88d5ba501b22635cfca49a5b3f234174b822230fe29

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