diff --git a/skyscanner.py b/skyscanner.py index 8f0de67..482596d 100644 --- a/skyscanner.py +++ b/skyscanner.py @@ -1,5 +1,6 @@ import requests import json +import urllib url = "https://skyscanner-skyscanner-flight-search-v1.p.rapidapi.com/apiservices/pricing/v1.0" APIKey = "c92d3c4eecmshb37fe7ee2e6c5eap106f08jsn556a682992c3" @@ -11,21 +12,32 @@ } 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", + "outboundDate": "2019-12-01", "adults": 1 } -req = requests.post(url,data=json.dumps(params),headers=headers) +req = requests.post(url,data = params,headers=headers) +print(req.status_code) req.raise_for_status() -print(req.status_code) \ No newline at end of file +urllib.request.urlopen(req) + +#r = req.headers +#print(r) +#print(r['Location']) + +#headers={ +# "X-RapidAPI-Host": "skyscanner-skyscanner-flight-search-v1.p.rapidapi.com", +# "X-RapidAPI-Key": APIKey, +# "Content-Type": "application/json" +#} + +#q = requests.post(r['Location'],headers = headers) + +#print(q) \ No newline at end of file