0

I went to the Skyscanner API documentation page, and selected "Python (Requests)" in the language selector. Then I copied the code snippet and changed the inbound and outbound dates to valid dates (i.e., dates later than today). But after running the code, I get blank results. Why is that?

import requests

url = "https://skyscanner-skyscanner-flight-search-v1.p.rapidapi.com/apiservices/pricing/v1.0"

payload = "inboundDate=2020-05-20&cabinClass=business&children=0&infants=0&country=US&currency=USD&locale=en-US&originPlace=SFO-sky&destinationPlace=LHR-sky&outboundDate=2020-05-15&adults=1"
headers = {
    'x-rapidapi-host': "skyscanner-skyscanner-flight-search-v1.p.rapidapi.com",
    'x-rapidapi-key': "MY_API_KEY", # need to fill up a form to get the Key
    'content-type': "application/x-www-form-urlencoded"
    }

response = requests.request("POST", url, data=payload, headers=headers)

print(response.text)

>>> {}
Kristada673
  • 3,512
  • 6
  • 39
  • 93

1 Answers1

0

Did you checked response example of that API?

Most of time when API have to return True then response blank also.