Phillip B Oldham schrieb:
Thanks for the info. That's working like a charm. Looks as though I'll
be able to handle all request types with that object.
I got a little worried then that the python dev's had missed something
truly important!
I've done that in urrlib2 like this:
class MyRequest(urllib2.Request):
def get_method(self):
if alternate_http_method is not None:
return alternate_http_method
return urllib2.Request.get_method(self)
THe alternate_http_method is part of a class-closure, but of course you
could do that with an instance variable as well.
I then use it like this:
req = MyRequest()
handlers = []
if USE_PROXY:
handlers.append(urllib2.ProxyHandler({'http' : PROXY}))
req = self._create_request(url, connector, urlparams,
queryparams, alternate_http_method)
opener = urllib2.build_opener(*handlers)
Diez
--
http://mail.python.org/mailman/listinfo/python-list