I’m trying to use Python’s requests library to automatically get my grades from a university website. The URL is http://ift.tt/2b04O3R, but there are several redirects. I have the following simple code but it doesn't seem to be doing what I want.
import requests
payload = {"user" : "username", "pass" : "password"}
r = requests.post("http://ift.tt/2b04O3R", data= payload)
print(r.text)
The output is as follows:
C:\Users\johnp\AppData\Local\Programs\Python\Python35-32\python.exe
C:/Users/johnp/Desktop/git_stuff/16AugRequests/acorn_requests.py <html> <head> </head> <body onLoad="document.relay.submit()"> <form method=post action="http://ift.tt/w3UYgA" name=relay> <input type=hidden name=pubcookie_g_req value="b25lPWlkcC51dG9yYXV0aC51dG9yb250by5jYSZ0d289Q0lNRl9TaGliYm9sZXRoX1BpbG90JnRocmVlPTEmZm91cj1hNWEmZml2ZT1HRVQmc2l4PWlkcC51dG9yYXV0aC51dG9yb250by5jYSZzZXZlbj1MMmxrY0M5QmRYUm9iaTlTWlcxdmRHVlZjMlZ5Um05eVkyVkJkWFJvJmVpZ2h0PSZob3N0bmFtZT1pZHAudXRvcmF1dGgudXRvcm9udG8uY2EmbmluZT0xJmZpbGU9JnJlZmVyZXI9KG51bGwpJnNlc3NfcmU9NSZwcmVfc2Vzc190b2s9LTczODQ3MDk2OCZmbGFnPTA=">
You do not have Javascript turned on, please click the button to continue.
Am I going about this the right way? I feel like I should be trying to pass a cookie instead, but how would I get the cookie?
Thanks in advance.
Aucun commentaire:
Enregistrer un commentaire