Skyscanner Python SDK for Skyscanner's API
- Free software: Apache license
- SDK Documentation: https://skyscanner.readthedocs.org.
- API Documentation: http://business.skyscanner.net/portal/en-GB/Documentation/ApiOverview
- Tested on Python 2.6, 2.7, 3.3, 3.4
- Supports Flights, Hotels, and Carhire
At the command line:
$ easy_install skyscanner
Or, if you have virtualenvwrapper installed:
$ mkvirtualenv skyscanner
$ pip install skyscanner
- If you don't already have one, create a Skyscanner account.
- Sign into your account and under Add Apps click Travel APIs to create an API key
Set your API Key in your code:
from skyscanner.skyscanner import Flights flights_service = Flights('<Your API Key>')
Get the flights live pricing result by writing a few lines of code:
from skyscanner.skyscanner import Flights flights_service = Flights('<Your API Key>') result = flights_service.get_result( country='UK', currency='GBP', locale='en-GB', originplace='SIN-sky', destinationplace='KUL-sky', outbounddate='2017-05-28', inbounddate='2017-05-31', adults=1).parsed print(result)
Note that both the inbounddate
and outbounddate
might need to be updated.
For more example usage, refer to the SDK documentation or the API documentation.
Tests might appear to be broken sometimes, this is due to the throttling in the API. In such cases, you will see the following error in the build log:
requests.exceptions.HTTPError: 429 Client Error: Too many requests in the last minute.
Please allow up to 15 minutes for your API key to be activated. Until it is activated you will get a 403 exception:
requests.exceptions.HTTPError: 403 Client Error: Forbidden for url: http://partners.api.skyscanner.net/apiservices/pricing/v1.0?apiKey=<Your API key>