Skip to main content

Python client/builder for Rainbow Hospitality Gateway REST and WebSocket APIs.

Project description

Rainbow Hospitality Gateway Python Client (rbh-builder-python)

Thin Python wrapper around the Rainbow Hospitality Gateway REST and WebSocket APIs (Edition 07 of the guide). It supports login, core reservation flows, guest management, wake-up calls, and the GraphQL WebSocket feed for call logs.

Installation

pip install -e .             # from this repo
pip install rbh-builder-python[ws]     # if published, includes optional websocket support

Quickstart

from rbh_builder import RainbowClient

client = (
    RainbowClient.builder(base_url="https://red-rhg.openrainbow.io/provisioningapi/api")
    .with_credentials(username="api_user", password="api_password")
    .build()
)

# Rooms
rooms = client.get_rooms(page_number=1, page_size=20)

# Check-in
client.checkin(
    room_id="101",
    checkout_date="2025-12-31",
    first_name="John",
    last_name="Doe",
    barring="local",  # local | nat_local | int_nat_local
)

# Wake-up call
client.create_wakeup_call(
    room_id="101",
    alarm_time="2025-12-24T07:00:00",
    followup_time="2025-12-24T07:10:00",
    frequency="Once",
)

WebSocket call logs (GraphQL)

import asyncio
from rbh_builder.ws import RainbowWebSocketClient

async def stream_logs():
    ws = RainbowWebSocketClient(
        access_token=client.access_token,
        app_key="your-app-key",
        company_id=client.company_id,
    )
    async for event in ws.subscribe_call_logs():
        print(event)

asyncio.run(stream_logs())

Endpoints covered

  • POST /Login to obtain JWT + company ID.
  • GET /GetRooms
  • GET /GetGuests
  • GET /GetCallLogs
  • POST /Checkin, POST /Checkout, POST /MoveRoom
  • POST /CreateGuest, PUT /UpdateGuest, DELETE /DeleteGuest
  • POST /CreateWakeupCall, PUT /UpdateWakeupCall, DELETE /DeleteWakeupCall, GET /GetWakeupCalls
  • WebSocket wss://rhg.openrainbow.io/provisioningapi/graphql subscription for call logs.

Notes from the API guide

  • Base URL: https://red-rhg.openrainbow.io/provisioningapi/api (update as needed for your environment)
  • Auth: POST /Login with JSON {Username, Password} returns AccessToken (JWT) and CompanyID.
  • Subsequent calls use header Authorization: Bearer <jwt>.
  • Pagination params: pageNumber, pageSize; most list endpoints require CompanyID and return { Code, Data: { Data, TotalCount, PageNumber, PageSize, TotalPages }, Status }.
  • Checkin requires CompanyID, RoomId, CheckoutDate, FirstName, LastName, Barring (one of local|nat_local|int_nat_local), optional GuestId.
  • Checkout requires CompanyID, RoomId, optional DeleteGuest flag.
  • MoveRoom requires CompanyID, RoomId (old), NewRoomId.
  • Guest create/update payloads include contact details; delete uses GuestId + CompanyID.
  • Wakeup calls: create {CompanyId, RoomId, AlarmTime, FollowupTime, Frequency}, update {Id, AlarmTime, FollowupTime}, delete {Id}, list requires CompanyID.
  • WebSocket uses GraphQL graphql-transport-ws subprotocol; connection init includes Authorization and x-app-key, then a subscription to logsArrived(companyId: $companyId); keep alive via {"type":"ping"}.

Auth refresh

  • When instantiated via the Builder (i.e., with credentials), the client will retry once on 401 by re-running POST /Login and refreshing the bearer token, then re-issuing the original request. If constructed with an access token only, refresh is not possible.

License

MIT (placeholder).

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

rbh_builder_python-0.1.0.tar.gz (7.0 kB view details)

Uploaded Source

Built Distribution

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

rbh_builder_python-0.1.0-py3-none-any.whl (11.7 kB view details)

Uploaded Python 3

File details

Details for the file rbh_builder_python-0.1.0.tar.gz.

File metadata

  • Download URL: rbh_builder_python-0.1.0.tar.gz
  • Upload date:
  • Size: 7.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.0

File hashes

Hashes for rbh_builder_python-0.1.0.tar.gz
Algorithm Hash digest
SHA256 97784791d79e0e68aae9114f7ac9dafabb9804f50df730fcd839483d6367e356
MD5 6a414e15f1f6a473719c5f83cb1ea66f
BLAKE2b-256 0675c7e6bb1bfb118a3642f3a4e4e837fdb67089de91868c8fc905c6bde8335f

See more details on using hashes here.

File details

Details for the file rbh_builder_python-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for rbh_builder_python-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 0b7e8cfb3e7dc5e7c2cbab8af0bd48c983d9ccd478109e15a190c5f984768e48
MD5 c0352b48a319fbeb9cff9929ab9ee218
BLAKE2b-256 864ef74d5f748efcb98af33e6ff02aaf5eff3e0fd156b4c6de46b1ea8583d5ee

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