Skip to content

vmavromatis/hotel-api-sdk-python

Repository files navigation

hotel-api-sdk-python

BOOKINGAPI is designed to book hotels in real time as fast as in two steps. It covers the complete booking process; it allows generating lists of hotels, confirming bookings, getting lists of bookings, obtaining booking information, making cancellations and modify existing bookings. BOOKINGAPI works in combination with CONTENTAPI to obtain content information from the hotels, such as pictures, description, facilities, services, etc. Please refer to the ContentAPI documentation and IO/DOCS for related information. BOOKINGAPI has been designed for a two steps confirmation, but due the the complexity of client and providers systems a third method has been designed.

This Python package is automatically generated by the Swagger Codegen project:

Requirements.

Python 2.7 and 3.4+

Installation & Usage

pip install

If the python package is hosted on Github, you can install directly from Github

For python 2

sudo pip2.7 install git+https://github.com/vmavromatis/hotel-api-sdk-python.git --upgrade

For python 3

sudo pip install git+https://github.com/vmavromatis/hotel-api-sdk-python.git --upgrade

(you may need to run pip with root permission: sudo pip install git+https://github.com//.git)

Then import the package:

import bookingapi 

Getting Started

Please follow the installation procedure and then run the following to make a status request:

from __future__ import print_function
import time, hashlib
import bookingapi
from bookingapi.rest import ApiException
from pprint import pprint
# create an instance of the API class
api_instance = bookingapi.StatusApi()
version = '1.0'  # str | Default version for this operation

# Your API Key and secret
apiKey = "xxxxxxxxxxxxxxxxxxxxxxx"
Secret = "xxxxxxxxxx"

# Signature is generated by SHA256 (Api-Key + Secret + Timestamp (in seconds))
sigStr = "%s%s%d" % (apiKey, Secret, int(time.time()))
signature = hashlib.sha256(sigStr).hexdigest()


api_instance.api_client.set_default_header('api-key', apiKey)
api_instance.api_client.set_default_header('x-signature', signature)


try:
    # Status check
    api_response = api_instance.status(version)
    pprint(api_response)
except ApiException as e:
    print("Exception when calling StatusApi->status: %s\n" % e)

Workflow

Refer to the wiki page for a basic workfow

Documentation for API Endpoints

All URIs are relative to https://api.test.hotelbeds.com/hotel-api

Class Method HTTP request Description
BookingsApi booking POST /{version}/bookings Booking confirm
BookingsApi booking_cancellation DELETE /{version}/bookings/{bookingId} Booking cancellation
BookingsApi booking_change PUT /{version}/bookings/{bookingId} Booking change
BookingsApi booking_detail GET /{version}/bookings/{bookingId} Booking detail
CheckratesApi check_rate POST /{version}/checkrates Check Availability Rates
HotelsApi availability POST /{version}/hotels Hotel availability
StatusApi status GET /{version}/status Check API status

Documentation For Models

Documentation For Authorization

# Your API Key and secret
apiKey = "xxxxxxxxxxxxxxxxxxxxxxx"
Secret = "xxxxxxxxxx"

# Signature is generated by SHA256 (Api-Key + Secret + Timestamp (in seconds))
sigStr = "%s%s%d" % (apiKey, Secret, int(time.time()))
signature = hashlib.sha256(sigStr).hexdigest()

api_instance.api_client.set_default_header('api-key', apiKey)
api_instance.api_client.set_default_header('x-signature', signature)

More info at https://developer.hotelbeds.com/docs/read/Home#authentication

Author

[email protected]

About

Python SDK for the Hotelbeds API http://developer.hotelbeds.com (BETA)

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published