使用python请求模块获取请求

时间:2018-02-21 08:39:20

标签: python web-scraping python-requests

我正在尝试使用请求模块通过https://www.easyjet.com获取flt信息和价格 当我填写表单easyjet.com并点击提交时,通过浏览器,它使用以下调用在内部获取数据:

https://www.easyjet.com/ejavailability/api/v15/availability/query?AdditionalSeats=0&AdultSeats=1&ArrivalIata=%23PARIS&ChildSeats=0&DepartureIata=%23LONDON&IncludeAdminFees=true&IncludeFlexiFares=false&IncludeLowestFareSeats=true&IncludePrices=true&Infants=0&IsTransfer=false&LanguageCode=EN&MaxDepartureDate=2018-02-23&MinDepartureDate=2018-02-23

当我试图通过使用以下代码来模仿相同时,我没有得到回复。我对这个领域很陌生。任何人都可以帮助理解出了什么问题? 这是我的代码

import requests


url = 'https://www.easyjet.com/en/'
url1 = 'https://www.easyjet.com/ejavailability/api/v15/availability/query?AdditionalSeats=0&AdultSeats=1&ArrivalIata=%23PARIS&ChildSeats=0&DepartureIata=%23LONDON&IncludeAdminFees=true&IncludeFlexiFares=false&IncludeLowestFareSeats=true&IncludePrices=true&Infants=0&IsTransfer=false&LanguageCode=EN&MaxDepartureDate=2018-02-23&MinDepartureDate=2018-02-21'
http = requests.Session()

response = http.get(url, verify=False)
response1 = http.get(url1, verify=False)

print(response1.text)

0 个答案:

没有答案