I am new to the request library and so far I have just followed sample codes provided in a textbook. The author of the textbook provided a sample of the following codes, requiring we use our own account/password to test out if it works.
however, I kept receiving 401 errors after I used the identical set of account name and password to log in through the browser.
url = "https://api.github.com/user"
user = '**********@gmail.com'
password = '**********'
r = requests.get(url, auth=(user, password))
if r.status_code == requests.codes.ok:
print(r.headers['Content-Type'])
print(r.json())
else:
print(r.status_code, "error")
since this is a relatively basic and straightforward code, I do not think some of the answers given in similar threads are applicable
since my original password includes special sign which I doubt if it is non ACII, I removed it and update my password and still getting 401 error. (and I found that the sign is in ACII later)