我有一个Python脚本,可以自动在https://tickets.liverpoolfc.com/PagesPublic/Home/home.aspx
上向您的购物篮添加票证现在该脚本将无法运行,但是相同的请求在Postman中也可以正常工作。 请求部分的工作方式如下:
addheaders = {'origin': "https://tickets.liverpoolfc.com",
'upgrade-insecure-requests': "1",
'content-type': "application/x-www-form-urlencoded",
'user-agent': "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.109 Safari/537.36",
'accept': "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8"}
body={'__VIEWSTATE':'/wEPDwUJMzkxOTk4MjAyD2QWAmYPZBYCZg9kFgICAw9kFgJmD2QWCAIDDw8WAh4HVmlzaWJsZWhkZAIHDw8WAh8AaGRkAhEPDxYCHwBoZGQCIQ9kFgICAQ9kFgICCQ9kFgQCHQ9kFgICAQ9kFgRmD2QWHAIBD2QWAgIBDxYCHgRUZXh0BRhTZWxlY3QgQnkgU3RhbmQgYW5kIEFyZWFkAgMPFgIfAWVkAgUPFgIfAQUNVGlja2V0IEZpbHRlcmQCBw8WAh8AZxYKAgEPFgIfAQUUV2hhdCBpcyB5b3VyIGJ1ZGdldD9kAgMPDxYCHwEFDU1pbmltdW0gUHJpY2VkZAIEEBAPFgYeDkRhdGFWYWx1ZUZpZWxkBQVQcmljZR4NRGF0YVRleHRGaWVsZAUFUHJpY2UeC18hRGF0YUJvdW5kZxYCHghvbmNoYW5nZQXJAWRvY3VtZW50LmdldEVsZW1lbnRCeUlkKCdTaXRlTWFzdGVyQm9keV9Db250ZW50UGxhY2VIb2xkZXIxX3VzY1NlYXRTZWxlY3Rpb25fdXNjU3RhbmRBbmRBcmVhU2VsZWN0aW9uX2hkZlNlbGVjdGVkTWluaW11bVByaWNlJykudmFsdWU9dGhpcy52YWx1ZTsgUmVEcmF3U3RhZGl1bShmYWxzZSwgdHJ1ZSwgZmFsc2UsIGZhbHNlLCBmYWxzZSwgZmFs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pb25faGRmQXJlYVNlbGVjdGVkJykudmFsdWUgPSBkb2N1bWVudC5nZXRFbGVtZW50QnlJZCgnYXJlYURyb3BEb3duTGlzdCcpLm9wdGlvbnNbMV0udmFsdWUgOw0KfQ0KfQ0KPC9zY3JpcHQ+ZAIBD2QWAgIBDxYCHwFlZAIgD2QWAgIEEBAPFgYfAgULUHJvZHVjdENvZGUfAwUSUHJvZHVjdERlc2NyaXB0aW9uHwRnZBAVAhNMSVZFUlBPT0wgViBXQVRGT1JEFExGQyBGT1VOREFUSU9OIEVWRU5UFQIGMThMSFdUBjE4TEdBQxQrAwJnZxYBAgFkZBgBBS5jdGwwMCRjdGwwMCR1c2NQZXJzb25hbGlzYXRpb25CYXJUb3AkTG9naW5WaWV3Dw9kAgFkHnzO56IhX/YZIlxUnOQWGCL0xwM=',
'ctl00$ctl00$SiteMasterBody$ContentPlaceHolder1$uscSeatSelection$btnBuy':'Buy',
'ctl00$ctl00$SiteMasterBody$ContentPlaceHolder1$uscSeatSelection$ddlGameSelection':'18LGAC',
'ctl00$ctl00$SiteMasterBody$ContentPlaceHolder1$uscSeatSelection$hdfSelectedSeats':'MSU-U9/82/0251#A',
'ctl00$ctl00$SiteMasterBody$ContentPlaceHolder1$uscSeatSelection$uscStandAndAreaSelection$hdfProductCode':'18LGAC',
'ctl00$ctl00$SiteMasterBody$ContentPlaceHolder1$uscSeatSelection$uscStandAndAreaSelection$hdfProductPriceBand':'A'}
body = urllib.urlencode(body)
addreq = requests.post('https://tickets.liverpoolfc.com/PagesPublic/ProductBrowse/VisualSeatSelection.aspx?campaign=&product=18LGAC&productIsHomeAsAway=N&productsubtype=HOME&stadium=AS&type=H', headers=addheaders, data=body, verify=True)
我收到200状态代码,但是票证未添加到购物篮中,但是,如果我通过邮递员发送此请求,则会将票证添加到购物篮中。