'Python Requests: PHP-Form login is not being sent

I'am trying to scrape this website: https://gb4.typewriter.at/. I'am struggling with logging in. The weird thing is: the form is being filled out but it is not sent, and therefore I don't get any cookies.

Here is what I tried:

import requests

url = "https://gb4.typewriter.at/"

s = requests.Session()


s.get(url)

payload = {
      "LoginForm[username]": "some_username",
      "LoginForm[pw]": "some_password",
}

r = self.session.post(
        f"{url}/index.php?r=site/login",
        data=payload,
)

print(r.content) # this prints the html with both forms filled
print(r.cookies) # gives me a PHPSESSID cookie, not the cookie I need, the site uses another one (some random chrachters) as authentication cookie.

I also tried to send a post request with Postman, which worked completely fine and logged me in.

I would really appreciate some help!



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source