Skip to content
This repository has been archived by the owner on Sep 17, 2020. It is now read-only.

Commit

Permalink
とりあえず最初のpost成功させるやつ(自前)
Browse files Browse the repository at this point in the history
  • Loading branch information
gen2127 committed Nov 8, 2019
1 parent c2816bb commit e49e3da
Showing 1 changed file with 19 additions and 7 deletions.
26 changes: 19 additions & 7 deletions 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"
Expand All @@ -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)
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)

0 comments on commit e49e3da

Please sign in to comment.