I\'m trying to create a python program that logs in to my university\'s site using my id and password. This is the formal page for logging in: https://webapp.pucrs.br/consul
I would try using the requests
library. The documentation is excellent, and the code ends up being much cleaner than with urllib*
$ pip install requests
Using a session (see comment by Piotr) that handles cookies on its own, the result looks like this
import requests
url_0 = "http://webapp.pucrs.br/consulta/principal.jsp"
url = "https://webapp.pucrs.br/consulta/servlet/consulta.aluno.ValidaAluno"
data = {"pr1": "123456789", "pr2": "1234"}
s = requests.session()
s.get(url_0)
r = s.post(url, data)
It seems to work fine, as I get a "Usuario inexistente" notice for pr1
123456789 and "Sehna inválida" with your user-number.