Suggestion: "Completing" HTTP support in Python.

Oleg Broytmann phd at phd.russ.ru
Thu Jun 15 12:39:50 EDT 2000


On Thu, 15 Jun 2000, Robb Shecter wrote:
> Oleg Broytmann wrote:
> 
> > On Thu, 15 Jun 2000, Robb Shecter wrote:
> > > h = HTTP('my.host.name', '/loginscript', 8080)
> > > (code, msg, headers) = h.post()
> >
> > import urllib
> > filename, headers = urllib.urlretrieve("http://my.host.name:8080/loginscript")
> >
> 
> Thanks for the reply, but I don't think that does what I'm looking for.
> (Although - it could very well be that I just don't know how to use the library!)
> 
> How do you add HTTP parameters?
> How do you specify that the connection should be POST or GET?

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}))

Oleg.            (All opinions are mine and not of my employer)
---- 
    Oleg Broytmann      Foundation for Effective Policies      phd at phd.russ.ru
           Programmers don't die, they just GOSUB without RETURN.





More information about the Python-list mailing list