Skip to content

Instantly share code, notes, and snippets.

@juanriaza
Created May 20, 2011 13:41
Show Gist options
  • Save juanriaza/982905 to your computer and use it in GitHub Desktop.
Save juanriaza/982905 to your computer and use it in GitHub Desktop.
import urllib2
class RequestWithMethod(urllib2.Request):
def __init__(self, method, *args, **kwargs):
self._method = method
super(RequestWithMethod, self).__init__(*args, **kwargs)
def get_method(self):
if getattr(self, '_method', False):
return self.method
return super(RequestWithMethod, self).get_method()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment