Giter Club home page Giter Club logo

hotel-api-sdk-python's Introduction

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]

hotel-api-sdk-python's People

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

hotel-api-sdk-python's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.