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 /Loginto obtain JWT + company ID.GET /GetRoomsGET /GetGuestsGET /GetCallLogsPOST /Checkin,POST /Checkout,POST /MoveRoomPOST /CreateGuest,PUT /UpdateGuest,DELETE /DeleteGuestPOST /CreateWakeupCall,PUT /UpdateWakeupCall,DELETE /DeleteWakeupCall,GET /GetWakeupCalls- WebSocket
wss://rhg.openrainbow.io/provisioningapi/graphqlsubscription 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 /Loginwith JSON{Username, Password}returnsAccessToken(JWT) andCompanyID. - Subsequent calls use header
Authorization: Bearer <jwt>. - Pagination params:
pageNumber,pageSize; most list endpoints requireCompanyIDand return{ Code, Data: { Data, TotalCount, PageNumber, PageSize, TotalPages }, Status }. CheckinrequiresCompanyID,RoomId,CheckoutDate,FirstName,LastName,Barring(one oflocal|nat_local|int_nat_local), optionalGuestId.CheckoutrequiresCompanyID,RoomId, optionalDeleteGuestflag.MoveRoomrequiresCompanyID,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 requiresCompanyID. - WebSocket uses GraphQL
graphql-transport-wssubprotocol; connection init includesAuthorizationandx-app-key, then a subscription tologsArrived(companyId: $companyId); keep alive via{"type":"ping"}.
Auth refresh
- When instantiated via the Builder (i.e., with credentials), the client will retry once on
401by re-runningPOST /Loginand 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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
97784791d79e0e68aae9114f7ac9dafabb9804f50df730fcd839483d6367e356
|
|
| MD5 |
6a414e15f1f6a473719c5f83cb1ea66f
|
|
| BLAKE2b-256 |
0675c7e6bb1bfb118a3642f3a4e4e837fdb67089de91868c8fc905c6bde8335f
|
File details
Details for the file rbh_builder_python-0.1.0-py3-none-any.whl.
File metadata
- Download URL: rbh_builder_python-0.1.0-py3-none-any.whl
- Upload date:
- Size: 11.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0b7e8cfb3e7dc5e7c2cbab8af0bd48c983d9ccd478109e15a190c5f984768e48
|
|
| MD5 |
c0352b48a319fbeb9cff9929ab9ee218
|
|
| BLAKE2b-256 |
864ef74d5f748efcb98af33e6ff02aaf5eff3e0fd156b4c6de46b1ea8583d5ee
|