https://github.com/vmavromatis/hotel-api-sdk-python
Python SDK for the Hotelbeds API http://developer.hotelbeds.com (BETA)
https://github.com/vmavromatis/hotel-api-sdk-python
Last synced: about 1 year ago
JSON representation
Python SDK for the Hotelbeds API http://developer.hotelbeds.com (BETA)
- Host: GitHub
- URL: https://github.com/vmavromatis/hotel-api-sdk-python
- Owner: vmavromatis
- License: lgpl-2.1
- Created: 2017-10-29T14:17:38.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2017-12-10T22:35:29.000Z (over 8 years ago)
- Last Synced: 2025-03-28T16:03:23.661Z (about 1 year ago)
- Language: Python
- Homepage:
- Size: 110 KB
- Stars: 4
- Watchers: 5
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# 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](https://github.com/swagger-api/swagger-codegen) project:
- API version: 1.0
- Package version: 1.0.0
- For more information, please visit [https://developer.hotelbeds.com](https://developer.hotelbeds.com)
## 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
```sh
sudo pip2.7 install git+https://github.com/vmavromatis/hotel-api-sdk-python.git --upgrade
```
For python 3
```sh
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:
```python
import bookingapi
```
## Getting Started
Please follow the [installation procedure](#installation--usage) and then run the following to make a status request:
```python
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](https://github.com/vmavromatis/hotel-api-sdk-python/wiki)
## Documentation for API Endpoints
All URIs are relative to *https://api.test.hotelbeds.com/hotel-api*
Class | Method | HTTP request | Description
------------ | ------------- | ------------- | -------------
*BookingsApi* | [**booking**](docs/BookingsApi.md#booking) | **POST** /{version}/bookings | Booking confirm
*BookingsApi* | [**booking_cancellation**](docs/BookingsApi.md#booking_cancellation) | **DELETE** /{version}/bookings/{bookingId} | Booking cancellation
*BookingsApi* | [**booking_change**](docs/BookingsApi.md#booking_change) | **PUT** /{version}/bookings/{bookingId} | Booking change
*BookingsApi* | [**booking_detail**](docs/BookingsApi.md#booking_detail) | **GET** /{version}/bookings/{bookingId} | Booking detail
*CheckratesApi* | [**check_rate**](docs/CheckratesApi.md#check_rate) | **POST** /{version}/checkrates | Check Availability Rates
*HotelsApi* | [**availability**](docs/HotelsApi.md#availability) | **POST** /{version}/hotels | Hotel availability
*StatusApi* | [**status**](docs/StatusApi.md#status) | **GET** /{version}/status | Check API status
## Documentation For Models
- [ApiAuditData](docs/ApiAuditData.md)
- [ApiBillingAddress](docs/ApiBillingAddress.md)
- [ApiBoards](docs/ApiBoards.md)
- [ApiBooking](docs/ApiBooking.md)
- [ApiBookingDevice](docs/ApiBookingDevice.md)
- [ApiBookingRoom](docs/ApiBookingRoom.md)
- [ApiBookings](docs/ApiBookings.md)
- [ApiCancellationPolicy](docs/ApiCancellationPolicy.md)
- [ApiCost](docs/ApiCost.md)
- [ApiCreditCard](docs/ApiCreditCard.md)
- [ApiDailyRate](docs/ApiDailyRate.md)
- [ApiDestination](docs/ApiDestination.md)
- [ApiError](docs/ApiError.md)
- [ApiFilter](docs/ApiFilter.md)
- [ApiGeoLocation](docs/ApiGeoLocation.md)
- [ApiHolder](docs/ApiHolder.md)
- [ApiHotel](docs/ApiHotel.md)
- [ApiHotels](docs/ApiHotels.md)
- [ApiHotelsFilter](docs/ApiHotelsFilter.md)
- [ApiKeyword](docs/ApiKeyword.md)
- [ApiKeywordsFilter](docs/ApiKeywordsFilter.md)
- [ApiModificationPolicies](docs/ApiModificationPolicies.md)
- [ApiOccupancy](docs/ApiOccupancy.md)
- [ApiOffer](docs/ApiOffer.md)
- [ApiPax](docs/ApiPax.md)
- [ApiPaymentCard](docs/ApiPaymentCard.md)
- [ApiPaymentContactData](docs/ApiPaymentContactData.md)
- [ApiPaymentData](docs/ApiPaymentData.md)
- [ApiPromotion](docs/ApiPromotion.md)
- [ApiRate](docs/ApiRate.md)
- [ApiRateBreakDown](docs/ApiRateBreakDown.md)
- [ApiRateDiscount](docs/ApiRateDiscount.md)
- [ApiRateSupplement](docs/ApiRateSupplement.md)
- [ApiReview](docs/ApiReview.md)
- [ApiReviewFilter](docs/ApiReviewFilter.md)
- [ApiRooms](docs/ApiRooms.md)
- [ApiShiftRate](docs/ApiShiftRate.md)
- [ApiSource](docs/ApiSource.md)
- [ApiStay](docs/ApiStay.md)
- [ApiSupplier](docs/ApiSupplier.md)
- [ApiTax](docs/ApiTax.md)
- [ApiTaxes](docs/ApiTaxes.md)
- [ApiUpselling](docs/ApiUpselling.md)
- [ApiVoucher](docs/ApiVoucher.md)
- [ApiVoucherComment](docs/ApiVoucherComment.md)
- [ApiVoucherEmail](docs/ApiVoucherEmail.md)
- [AvailabilityRQ](docs/AvailabilityRQ.md)
- [AvailabilityRS](docs/AvailabilityRS.md)
- [BookingCancellationRS](docs/BookingCancellationRS.md)
- [BookingChangeRQ](docs/BookingChangeRQ.md)
- [BookingChangeRS](docs/BookingChangeRS.md)
- [BookingDetailRS](docs/BookingDetailRS.md)
- [BookingListRS](docs/BookingListRS.md)
- [BookingRQ](docs/BookingRQ.md)
- [BookingRS](docs/BookingRS.md)
- [CheckRateRQ](docs/CheckRateRQ.md)
- [CheckRateRS](docs/CheckRateRS.md)
- [Room](docs/Room.md)
- [StatusRS](docs/StatusRS.md)
## Documentation For Authorization
```python
# 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
developer@hotelbeds.com