0

I am confused that I have tried to login for several times. But it doesn't work.

It's my code.

import requests

headers = {
  'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.77 Safari/537.36 Edg/91.0.864.37',    
    }

data = {
    'user':'********',   
    'pass':'********',
}

loginurl ='https://web2.cc.ntu.edu.tw/p/s/login2/p1.php'
session = requests.Session()
post = session.post(loginurl,headers = headers,data = data)

response = session.get('https://reg.aca.ntu.edu.tw/queryarr/main_stu.asp',headers = headers)

print(response.text)

Do I miss something like other items in headers?

Thanks.

  • Does this answer your question? [How to "log in" to a website using Python's Requests module?](https://stackoverflow.com/questions/11892729/how-to-log-in-to-a-website-using-pythons-requests-module) – itprorh66 Jun 04 '21 at 21:04

0 Answers0