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

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for krossapy-0.0.7.tar.gz
Algorithm Hash digest
SHA256 2880d2b8275a31d900c62f15a563039cf7eeef7a0cb6f08e97a08b33076fc5e7
MD5 fc9c5a5c9734bc3e1b7532b6d16e6c19
BLAKE2b-256 634d9ca96e3c0441f08c746f6226b09bcced3606499dafdfa9d3b702fa58b66c

See more details on using hashes here.

File details

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

File metadata

  • Download URL: krossapy-0.0.7-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.3

File hashes

Hashes for krossapy-0.0.7-py3-none-any.whl
Algorithm Hash digest
SHA256 3f740961478767f9d294a00c2eb1810fa3eb9b2b100365f15793c12b24d5b6bd
MD5 23418d8d83df86e3062f1e8d4a4dea46
BLAKE2b-256 4fda4d3826a4414aaa2b22064c979958359663438c387aa459a6d364b688c2ac

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