问题
I'm running phantomJS and using it to scrape a website for its 'client id' and 'site key'. And I want to implement the site key & client id into a request session in python to have access to the same webpage i did in the PhantomJS browser session. Any tips on how to accomplish this using requests in python.
Please note that I've already figured out how to scrape the website, I just don't understand how to implement the SITE KEY & CLIENT ID into my python request session!
Here's what I tried,
client id: '842085ea-09be-46e0-b0b4-9d7535ad5b69'
site key: '6Ler0hUUAAAAANikfVz6I1o0Mdzj0hwX2XFsl4Oy'
headers = {
'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/57.0.2987.98 Safari/537.36',
'Accept-Encoding': 'gzip, deflate, sdch, br',
'Accept-Language': 'en-US,en;q=0.8',
'Upgrade-Insecure-Requests': '1'
}
requests.get('http://www.adidas.com/us/pureboost-shoes/CG2986.html' , headers=headers, auth=HTTPBasicAuth('842085ea-09be-46e0-b0b4-9d7535ad5b69','6Ler0hUUAAAAANikfVz6I1o0Mdzj0hwX2XFsl4Oy')
here
来源:https://stackoverflow.com/questions/44511507/how-to-implement-site-key-client-id-in-request-session