Python Forum

Full Version: Token and auth-token
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hey all.
I have problem which i dont quite understand how to go about from here.
I use request library to sign-in to website and I believe im doing that right. I make a post request to /sign-in page and response to the POST request is following

I basically expecting some html back if the login was successful. But instead I get these token. What do I do with these token from here. My code looks like this.

with requests.Session() as s:
    url = ""
    url2 = ""
    r = s.get(url, headers=headers)
    soup = BeautifulSoup(r.content, 'html5lib')
    login_data['authenticity_token'] = soup.find('input', attrs={'name': 'authenticity_token'})['value']
    r1 =, data=login_data, headers=headers)
    r2 = s.get(url2, headers=headers)
any help would be much appreciated


Just to add more information. Im trying to login to nutmeg account.
Probably the site you are parsing is a kind of SPA application. This kind of sites don't return HTML as a response, they work over AJAX and receive only JSON.