I am trying to send a request to enter a site using the Requests module in Python, but it does not work. I'm new to this ... so I can't figure out if I have to make my Username and Password cookies or some kind of HTTP authorization that I found (??).
from pyquery import PyQuery import requests url = 'http://www.locationary.com/home/index2.jsp'
So, now I think I should use the "post" and cookies ...
ck = {'inUserName': 'USERNAME/EMAIL', 'inUserPass': 'PASSWORD'} r = requests.post(url, cookies=ck) content = r.text q = PyQuery(content) title = q("title").text() print title
I feel like I'm doing cookies wrong ... I don't know.
If it does not register correctly, the title of the homepage should appear on "Locationary.com", and if so, it should be "Homepage".
If you could explain to me a few things about requests and cookies and help me with this, I would really appreciate it .: D
Thank.
... It still doesn't work. Ok ... so this is what the HTML page of the homepage says before you log in:
</td><td><img src="http://www.locationary.com/img/LocationaryImgs/icons/txt_email.gif"> </td> <td><input class="Data_Entry_Field_Login" type="text" name="inUserName" id="inUserName" size="25"></td> <td><img src="http://www.locationary.com/img/LocationaryImgs/icons/txt_password.gif"> </td> <td><input class="Data_Entry_Field_Login" type="password" name="inUserPass" id="inUserPass"></td>
So, I think I'm doing it right, but the exit is still "Locationary.com"
2nd EDIT:
I want to be able to stay on the system for a long time, and whenever I request a page in this domain, I want the content to appear as if I were logged in.
python python-requests pyquery
Marcus Johnson Aug 09 '12 at 22:12 2012-08-09 22:12
source share