vendredi 26 juillet 2019

Python Request Results In 401 Unauthorized

I have logged into a website using python requests, but when I want to start scraping data from other pages on the site, it seems like I'm no longer authenticated? I'm recieving a 401 error when trying to access part of the site that starts with "https://api"

I've tried using auth, proxies, but nothing is working. Works perfectly fine in Chrome. Also after I login I am able to see that my information is appearing in some of the api content, but when I do a GET on the homepage of the website I am not longer logged in.

payload_login = {'email': 'me@email.com', 'password': 'password'}

with requests.Sessions() as s:
    url = 'https:/api.website.com/login"
    r = s.post(url, data=login_data)
    print r.content ###this acutally returns 200 meaning I've successfully login in
    print s.get('https://api.website.com/userProjects', auth=HttpNtlmAuth(user,pass)


Output is <Response [401]>




Aucun commentaire:

Enregistrer un commentaire