I am trying to login with a script in the website: https://interpals.net/app/auth/login My code is the following
#! /usr/bin/env python
# -*- coding: utf-8 -*-
from requests import Session
from bs4 import BeautifulSoup as bs
with Session() as s:
site = s.get("https://interpals.net/app/auth/login")
bs_content = bs(site.content, "html.parser")
token = bs_content.find("input", {"name":"csrf_token"})["value"]
login_data = {"username":"user","password":"pass'", "csrf_token":token}
s.post("https://interpals.net/app/auth/login",login_data)
home_page = s.get("https://interpals.net/pm.php")
My first trouble is that when I write the parameter "html.parser" I do not get a correct parser, in fact, I do not even get the right html, this is what I got
https://paste.fedoraproject.org/paste/K1SCjKBG7CAigUH4GX7qUQ
When I change "html.parser" to "lxml" or "html5lib" I get indeed a HTML form, which is this
https://paste.fedoraproject.org/paste/4w-AT20kTIXoAmgsPmpqIQ
However, in this last one I do not found the input csrf_token which is what I need in order to login on, anybody could give an advice, please?