Building browser-like GET request

Gilles Ganault nospam at nospam.com
Sat Apr 21 17:28:56 EDT 2007


Hello

	I'd like to download pages from a site, but it checks whether
the requests are coming from a live user or a script; If the latter,
the server returns a blank page.

Using a proxy (Paros), I can see what information my script and
FireFox send, and there are a lot of information that Python is
missing:

======== PYTHON ===============
http://www.acme.com/cgi-bin/read?code=123  HTTP/1.1
Accept-Encoding: identity
Host: www.acme.com
Connection: close
User-Agent: Python-urllib/2.4 Paros/3.2.12
======== FIREFOX ===============
http://www.acme.com/cgi-bin/read?code=123  HTTP/1.1
Host: www.acme.com
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US;
rv:1.8.1.3) Gecko/20070309 Firefox/2.0.0.3 Paros/3.2.12
Accept:
text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5
Accept-Language: fr-fr,en-us;q=0.7,en;q=0.3
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 300
Proxy-Connection: keep-alive
=============================

How can Python be told to send the same information?

Thank you.



More information about the Python-list mailing list