Does urllib2 support DELETE or PUT method? If yes provide with any example please. I need to use piston API.
You can subclass the urllib2.Request object and override the method when you instantiate the class.
import urllib2
class RequestWithMethod(urllib2.Request):
def __init__(self, method, *args, **kwargs):
self._method = method
urllib2.Request.__init__(*args, **kwargs)
def get_method(self):
return self._method
Courtesy of Benjamin Smedberg