Suggestion: "Completing" HTTP support in Python.

Henning Schroeder hschroeder at gmx.net
Fri Jun 16 04:11:47 EDT 2000


Edward Jason Riedy <ejr at lotus.CS.Berkeley.EDU> wrote:
>  - GET:  filename, headers = 
>	urllib.urlretrieve("http://my.host.name:8080/loginscript?%s" % 
>	urllib.urlencode({"param": value}))
>  - POST: filename, headers = 
>	urllib.urlretrieve("http://my.host.name:8080/loginscript", 
>	urllib.urlencode({"param": value}))
To: python-list at python.org
Sender: python-list-admin at python.org
Errors-To: python-list-admin at python.org
X-BeenThere: python-list at python.org
X-Mailman-Version: 2.0beta3
Precedence: bulk
List-Id: General discussion list for the Python programming language <python-list.python.org>

Cool. I wasn't aware of this feature using urlencode. (Although I have
been using urllib heavily...)
Path: news!uunet!ffx.uu.net!newsfeed.easynews.net!easynews.net!unlisys!news.snafu.de!fu-berlin.de!uni-berlin.de!pc19eb635.dip.t-dialin.NET!not-for-mail
Xref: news comp.lang.python:99882

> You only answered half of his request.  The other half is _not_
> supported by urllib: adding HTTP headers.
You can add headers with urllib:
	con = urllib.FancyURLopener()
        con.addheader("Referer", "http://www.python.org")
        f = con.open("http://www.yahoo.com", postdata)
	...
        con.close()


Henning

-- 
henning.schroeder at informatik.uni-oldenburg.de
ich at henning-schroeder.de  *  http://www.henning-schroeder.de



More information about the Python-list mailing list