Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
163 views
in Technique[技术] by (71.8m points)

python - How to get correct response by adidas api

Trying to get info about items in stores of adidas. This can be done by using this link https://www.adidas.ru/api/inventory-check and sending this params (or just open https://www.adidas.ru/botinki-dlia-khaikinga-terrex-frozetrack-winter/AC7841.html and click on the "Проверить наличие в магазине" under add to cart button):

isCnCRestricted: false
lat: 57.8166994
lng: 28.3344734
recaptcha: 03AGdBq27cGPkPopL3blXBasx7DtENAPrbKnSLw_3nMbuFEhvQfnQkIVJzueFjPvU5vyH-yFKQjLIOIqvMlQQjLtY1oZQgHwtobKVNiBbPMKuZDbohiNas0SzofNLnedbXURfYqn_i78KaP6cEn0p4O8bXrQEE8kJaj1Ysy23igNWdnyMfTo4SwDCiK2qThBrdKJQfIofbQ4Xztsc23UUAy1rLZCA1Ik6ldB4IE8OiP9n1RFdBK-Ad4lrct8HF6RWbQGoXxHFwqNWclyuhjKrtKbptFgd7uxbj2AODmnB7PZJhCZE8drd8C-lnltFONnpqui_d6mOSa1FyfIeWx-8AJ8L4JjqT6snS0-0jFkKk1-LUdan5mzQu73L_u-XegfyZqJgAfD5c7BdUBMOkLOwsF6jzE1FlMRVM2_5S1IhduDPdvKO6GXZNsqifxuR0cjh5KV9qIUBKH-yM
sku: AC7841_650

Using this headers

headers = {
        'accept': '*/*',
        'accept-encoding': 'gzip, deflate, br',
        'accept-language': 'ru-RU,ru;q=0.9,en-US;q=0.8,en;q=0.7',
        'content-type': 'application/json',
        'referer': 'https://www.adidas.ru/botinki-dlia-khaikinga-terrex-frozetrack-winter/AC7841.html',
        'sec-ch-ua': '"Google Chrome";v="87", " Not;A Brand";v="99", "Chromium";v="87"',
        'sec-ch-ua-mobile': '?0',
        'sec-fetch-dest': 'empty',
        'sec-fetch-mode': 'cors',
        'sec-fetch-site': 'same-origin',
        'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.141 Safari/537.36'
}

If i sending this request manually by fiddler (the capcha token can be used more than once and after ~5 minuts die) i get response, but when i sending the same request by python i get the access denied response

<TITLE>Access Denied</TITLE>
</HEAD><BODY>
<H1>Access Denied</H1>```
 
You don't have permission to access "http&#58;&#47;&#47;www&#46;adidas&#46;ru&#47;api&#47;inventory&#45;check&#63;" on this server.<P>
Reference&#32;&#35;18&#46;3c492bbc&#46;1611904909&#46;167f530
</BODY>
</HTML>

What i doing wrong? How to get correct answer?

question from:https://stackoverflow.com/questions/65950442/how-to-get-correct-response-by-adidas-api

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...