Я пытаюсь войти на эту страницу с помощью Python. Вот мой код
from urllib2 import urlopen
from bs4 import BeautifulSoup
import requests
import sys
URL= 'http://coe2.annauniv.edu/result/index.php'
soup = BeautifulSoup(urlopen(URL))
for hit in soup.findAll(attrs={'class' : 's2'}):
print hit.contents[0].strip()
RegisterNumber = raw_input("enter the register number")
DateofBirth = raw_input("enter the date of birth [DD-MM-YYYY]")
login_input = raw_input("enter the what is()?")
def main():
# Start a session so we can have persistant cookies
session = requests.session()
# This is the form data that the page sends when logging in
login_data = {
'register_no':'RegisterNumber',
'dob':'DateofBirth',
'security_code_student' :'login_input',
'gos': 'Login',
}
# Authenticate
r = session.post(URL, data=login_data)
# Try accessing a page that requires you to be logged in
r = session.get('http://coe2.annauniv.edu/result/students_corner.php')
if __name__ == '__main__':
main()
Я пытался использовать запросы. но приведенный выше код не может получить доступ к странице, требующей входа в систему.
Что я делаю неправильно?