Skip to main content

Unofficial Python 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.5.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.5-py3-none-any.whl (15.3 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for krossapy-0.0.5.tar.gz
Algorithm Hash digest
SHA256 05b07de1ce618b9649a0b655cecdf2684a7730cb06a289d6d784b0678bfd5bc3
MD5 f2b34791884437165bf3b36c56fef596
BLAKE2b-256 140c4dae5376db29145dd4a0ccd386674ecdfd32dda574e058b9784e709823e3

See more details on using hashes here.

File details

Details for the file krossApy-0.0.5-py3-none-any.whl.

File metadata

  • Download URL: krossApy-0.0.5-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.1

File hashes

Hashes for krossApy-0.0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 decd39103a194a40fca1b5c690b2c0a7ada47561dfe4b66d3454d8a196cdc4ee
MD5 1436da8fae3680505a0266a0ef1c9520
BLAKE2b-256 61922c62312453b6b6b465c15a8d5966021e3989da39d65344def9303bcd04a3

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