C
C
couatl2011-10-07 14:57:50
Python
couatl, 2011-10-07 14:57:50

Login to Habré (and other sites) via Python (urllib)?

How to log in to Habré through the urllib Python library.
I saw in Q&A “how to log in to VKontakte via get-requests”, so the question is how to independently find ways to log in to other sites, and not constantly ask for each site separately.

Answer the question

In order to leave comments, you need to log in

3 answer(s)
R
robofox, 2011-10-07
@couatl

Install yourself an http sniffer . If you have firefox, I recommend the HttpFox add-on .
How to find out what request to send for login:
Turn on the sniffer, log in to the site (it is better to turn on the sniffer directly at the time of login so as not to clog it with unnecessary requests), then see what the browser has sent to the server. Usually this is one POST request, in the fields of which you can find the login and password. The same request must be sent by a script.

U
un1t, 2011-10-07
@un1t

Send a POST or GET login request, depending on the site. See Set-Cookie in the response in headers
and send with the Cookie header in the following requests (example Cookie: xxx=yyy).
Read about how cookies work in HTTP or look at the request headers in the firebug.

K
Konstantin, 2011-10-07
@Norraxx

selenium

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question