Skyscanner API Python
You can use the Skyscanner Flight Search API with Python by utilizing unirest.
Installing & Making a Request
To use Unirest for Python, install it using pip:
$ pip install unirest
After installing the pip package, you can now begin making API requests by importing unirest and forming a request:
import unirest response = unirest.post(API_URL, headers={ "X-RapidAPI-Key": API_KEY, "Content-Type": "application/x-www-form-urlencoded" }, params={ "parameter": "value" } ) response.code # The HTTP status code response.headers # The HTTP headers response.body # The parsed response response.raw_body # The unparsed response
How to Start
- Navigate to the Skyscanner Flight Search API Documentation Page.
- Select an endpoint you would like to use and select Python from the Code Snippet dropdown.
- Copy the code snippet and apply it to your application!
What data is available with the Skyscanner Flight Search API?
Browse the available API endpoints & example code snippets below for available data & datasets for flights using Skyscanner API (in Python).
Live Flight Search
POST Create Session
Create a flight search session. A successful response contains no content. The session key to poll the results are provided in the Location header of the response. The last value of the location header contains the session key which is required when polling the session.
response = unirest.post("https://skyscanner-skyscanner-flight-search-v1.p.rapidapi.com/apiservices/pricing/v1.0", headers={ "X-RapidAPI-Host": "skyscanner-skyscanner-flight-search-v1.p.rapidapi.com", "X-RapidAPI-Key": "SIGN-UP-FOR-KEY", "Content-Type": "application/x-www-form-urlencoded" }, params={ "inboundDate": "2019-09-10", "cabinClass": "business", "children": 0, "infants": 0, "country": "US", "currency": "USD", "locale": "en-US", "originPlace": "SFO-sky", "destinationPlace": "LHR-sky", "outboundDate": "2019-09-01", "adults": 1 } )
GET Poll Session Results
Get itineraries from a created session.
response = unirest.get("https://skyscanner-skyscanner-flight-search-v1.p.rapidapi.com/apiservices/pricing/uk2/v1.0/{sessionkey}?pageIndex=0&pageSize=10", headers={ "X-RapidAPI-Host": "skyscanner-skyscanner-flight-search-v1.p.rapidapi.com", "X-RapidAPI-Key": "SIGN-UP-FOR-KEY" } )
Places
GET List Places
Get a list of places that match a query string.
response = unirest.get("https://skyscanner-skyscanner-flight-search-v1.p.rapidapi.com/apiservices/autosuggest/v1.0/UK/GBP/en-GB/?query=Stockholm", headers={ "X-RapidAPI-Host": "skyscanner-skyscanner-flight-search-v1.p.rapidapi.com", "X-RapidAPI-Key": "SIGN-UP-FOR-KEY" } )
Browse Flight Prices
GET Browse Quotes
Retrieve the cheapest quotes from our cache prices.
response = unirest.get("https://skyscanner-skyscanner-flight-search-v1.p.rapidapi.com/apiservices/browsequotes/v1.0/US/USD/en-US/SFO-sky/JFK-sky/2019-01-01?inboundpartialdate=2019-09-01", headers={ "X-RapidAPI-Host": "skyscanner-skyscanner-flight-search-v1.p.rapidapi.com", "X-RapidAPI-Key": "SIGN-UP-FOR-KEY" } )
GET Browse Routes
Retrieve the cheapest routes from our cache prices. Similar to the Browse Quotes API but with the routes built for you from the individual quotes.
response = unirest.get("https://skyscanner-skyscanner-flight-search-v1.p.rapidapi.com/apiservices/browseroutes/v1.0/US/USD/en-US/SFO-sky/ORD-sky/2019-01-01?inboundpartialdate=2019-09-01", headers={ "X-RapidAPI-Host": "skyscanner-skyscanner-flight-search-v1.p.rapidapi.com", "X-RapidAPI-Key": "SIGN-UP-FOR-KEY" } )
GET Browse Dates
Retrieve the cheapest dates for a given route from our cache.
response = unirest.get("https://skyscanner-skyscanner-flight-search-v1.p.rapidapi.com/apiservices/browsedates/v1.0/US/USD/en-US/SFO-sky/LAX-sky/2019-01-01?inboundpartialdate=2019-09-01", headers={ "X-RapidAPI-Host": "skyscanner-skyscanner-flight-search-v1.p.rapidapi.com", "X-RapidAPI-Key": "SIGN-UP-FOR-KEY" } )
GET Browse Dates Inbound
Retrieve the cheapest dates for a given route from our cache. Must include inboundpartialdate
.
response = unirest.get("https://skyscanner-skyscanner-flight-search-v1.p.rapidapi.com/apiservices/browsedates/v1.0/{country}/{currency}/{locale}/{originplace}/{destinationplace}/{outboundpartialdate}/{inboundpartialdate}", headers={ "X-RapidAPI-Host": "skyscanner-skyscanner-flight-search-v1.p.rapidapi.com", "X-RapidAPI-Key": "SIGN-UP-FOR-KEY" } )
GET Browse Quotes Inbound
Retrieve the cheapest quotes from our cache prices. Must include inboundpartialdate.
response = unirest.get("https://skyscanner-skyscanner-flight-search-v1.p.rapidapi.com/apiservices/browsequotes/v1.0/{country}/{currency}/{locale}/{originplace}/{destinationplace}/{outboundpartialdate}/{inboundpartialdate}", headers={ "X-RapidAPI-Host": "skyscanner-skyscanner-flight-search-v1.p.rapidapi.com", "X-RapidAPI-Key": "SIGN-UP-FOR-KEY" } )
GET Browse Routes Inbound
Retrieve the cheapest routes from our cache prices. Similar to the Browse Quotes API but with the routes built for you from the individual quotes. Must include inboundpartialdate
response = unirest.get("https://skyscanner-skyscanner-flight-search-v1.p.rapidapi.com/apiservices/browseroutes/v1.0/{country}/{currency}/{locale}/{originplace}/{destinationplace}/{outboundpartialdate}/{inboundpartialdate}", headers={ "X-RapidAPI-Host": "skyscanner-skyscanner-flight-search-v1.p.rapidapi.com", "X-RapidAPI-Key": "SIGN-UP-FOR-KEY" } )
Localisation
GET List markets
Retrieve the market countries that we support. Most suppliers (airlines, travel agents and car hire dealers) set their fares based on the market (or country of purchase). It is, therefore, necessary to specify the market country in every query.
response = unirest.get("https://skyscanner-skyscanner-flight-search-v1.p.rapidapi.com/apiservices/reference/v1.0/countries/en-US", headers={ "X-RapidAPI-Host": "skyscanner-skyscanner-flight-search-v1.p.rapidapi.com", "X-RapidAPI-Key": "SIGN-UP-FOR-KEY" } )
GET Currencies
Retrieve the currencies that we support.
response = unirest.get("https://skyscanner-skyscanner-flight-search-v1.p.rapidapi.com/apiservices/reference/v1.0/currencies", headers={ "X-RapidAPI-Host": "skyscanner-skyscanner-flight-search-v1.p.rapidapi.com", "X-RapidAPI-Key": "SIGN-UP-FOR-KEY" } )