简体   繁体   中英

Python Requests Access Denied

When I try to login into GameStop with requests, this is what I get. What am I doing wrong or what am I missing?

import requests
import json

headers = {'User-Agent':'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/95.0.4638.54 Safari/537.36'}
payload = {
    'UserName': '*****',
    'Password': '******',
    'RememberMe': 'false'
}
with requests.session() as s:
    r = s.post('https://www.gamestop.ca/Account/LogOn', headers=headers, data=payload)
print(r.status_code)
print(r.content)
print(r.text)
403
b'<HTML><HEAD>\n<TITLE>Access Denied</TITLE>\n</HEAD><BODY>\n<H1>Access Denied</H1>\n \nYou don\'t have permission to access "http&#58;&#47;&#47;www&#46;gamestop&#46;ca&#47;Account&#47;LogOn" on this server.<P>\nReference&#32;&#35;18&#46;70fd017&#46;1635453520&#46;211da9c5\n</BODY>\n</HTML>\n'
<HTML><HEAD>
<TITLE>Access Denied</TITLE>
</HEAD><BODY>
<H1>Access Denied</H1>
 
You don't have permission to access "http&#58;&#47;&#47;www&#46;gamestop&#46;ca&#47;Account&#47;LogOn" on this server.<P>
Reference&#32;&#35;18&#46;70fd017&#46;1635453520&#46;211da9c5
</BODY>
</HTML>

re

does not really seem like you are doing something wrong its just you probably need to authenticate first, I dont know that api but before sending POST request to "Account/LogOn" endpoint you need to get a token or key to authorize your requests.The HTTP 403 Forbidden client error status response code indicates that the server understands the request but refuses to authorize it.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM