我正在使用Python从southwest.com收集价格数据。 尝试收集其低票价日历价格。 示例页面:https://www.southwest.com/air/low-fare-calendar/select-dates.html?adultPassengersCount=1¤cyCode=USD&departureDate=2019-04-25&destinationAirportCode=MCO&originationAirportCode=MDW&passengerType=ADULT&returnAirportCode=&returnDate=&tripType=oneway
所需的数据是从发给https://www.southwest.com/api/air-booking/v1/air-booking/page/air/low-fare-calendar/select-dates的发布请求中获得的。
问题出在以x-开头的标头中:
x-5ku220jw-a: I_ftfpDjDyifDufjizDcDs7teKDhlBY7UN6xgaX7hf8wp7=ZfV=ZiagmgMX1lgT1Yf8tIziO2PrYhLk6DprKAQChh-kEK2=QDyutU3E-gz6wgBpYQrUf8KlMjN6c0aP_95jAIV9BYr35sb66QM06CZP3IZrgF1XwfgNR0akQIc5tIaOIYagjTf1yAyP3louw57s3iZ_m07huHuaxFJI7lU_IFSvNg91IMb8riZ_RIcUrp7rNlpUffIUfqa8aIrEPkaSxiI=wPSP3k9=c1yvM8ikxhZ6h9t1kjSgmibYJInPU8hPfp-3uezOfeKLZIiQypKSQl14WSN_BPJURUaP1qa9R87EBFb8AqSv-ia7IiB0jlzSZ5IktfFfu2asJBII5lh5ss-XagNiZflSxYf8ZPVCljvSzl36bldUMFhj18zkI07=tgkXuU0UcZ7BPpb8tI3=3jr8-I-5QpfLBKWk3iq0bpK7KIsh7C3Ke1cB7t_S32kXhi_fBYN6VpIfu0-kyi753uzv0I-Q5=UsBYNP3DskijalfqWYP2kf5ly6mDILRqLimi7=AE3=tDcsM8-06fr7zDaLcc9I72zBRfIrLqN6Ch-b8D_f7fNuM__MCgaJLDkfhOBSwk-8yI-lusLPFvrN4fejQR79fsLmxFhrRS7jeEbItf_gBPKYS93w6YNimDrfaXR4uICfPKNP6fZP6ldEpciwKqNu7qMBRm3=mDavQ2szxqr=Cf9Yti-YuEU9c3I7t5WkQDs=LlDID2zSMp-gZI-BSf-0bkfURp3Y5fiRuirrB0aFBqf=SNVjLmBY5jakHlzURuu8cTM5w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L7WRKJL2s2ZrEiksXMK8pm-YimkgmLAawUHfGuclcCwH8AABszAAAAAA==
我不知道它们来自哪里以及如何获得它们,但是如果没有它们(或其中之一),代码将无法工作。我对此很有把握,因为从不需要使用这些标头的站点向另一个URL发送请求时,我可以获得响应。
因此,问题是: 1.这些标题是什么? 2.如何获得这些标头的值(如果可能)?
我的代码:
import requests
data_url = 'https://www.southwest.com/api/air-booking/v1/air-booking/page/air/low-fare-calendar/select-dates'
payload = {
"adultPassengersCount": "1",
"currencyCode": "USD",
"departureDate": "2019-04-25",
"destinationAirportCode": "MCO",
"originationAirportCode": "MDW",
"passengerType": "ADULT",
"returnAirportCode": "",
"returnDate": "",
"tripType": "oneway",
"application": "air-low-fare-calendar",
"site": "southwest"
}
headers = {
'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/73.0.3683.103 Safari/537.36',
'x-api-key': 'l7xx944d175ea25f4b9c903a583ea82a1c4c'
}
r = requests.post(data_url, json=payload, headers=headers)
print(r.text)