setting of HTTP methods.
"""
- def __init__(self, url, data=None, headers={}, origin_req_host=None, unverifiable=False, method=None):
- urllib2.Request.__init__( self, url, data, headers, origin_req_host, unverifiable)
+ def __init__(self, url, data=None, headers={}, origin_req_host=None,
+ unverifiable=False, method=None):
+ urllib2.Request.__init__(self, url, data, headers, origin_req_host, unverifiable)
self.method = method
def get_method(self):
_METHODS = ('GET', 'HEAD', 'PUT', 'POST', 'DELETE')
- def __init__(self, url=None, headers=dict(), files=None, method=None, params=dict(), data=dict(), auth=None, cookiejar=None):
+ def __init__(self, url=None, headers=dict(), files=None, method=None,
+ params=dict(), data=dict(), auth=None, cookiejar=None):
self.url = url
self.headers = headers
self.files = files
:param auth: (optional) AuthObject to enable Basic HTTP Auth.
"""
- r = Request(method='GET', url=url, params=params, headers=headers, cookiejar=cookies, auth=_detect_auth(url, auth))
+ r = Request(method='GET', url=url, params=params, headers=headers,
+ cookiejar=cookies, auth=_detect_auth(url, auth))
r.send()
return r.response
:param cookies: (optional) CookieJar object to send with the :class:`Request`.
:param auth: (optional) AuthObject to enable Basic HTTP Auth.
"""
- r = Request(method='HEAD', url=url, params=params, headers=headers, cookiejar=cookies, auth=_detect_auth(url, auth))
+ r = Request(method='HEAD', url=url, params=params, headers=headers,
+ cookiejar=cookies, auth=_detect_auth(url, auth))
r.send()
return r.response
:param auth: (optional) AuthObject to enable Basic HTTP Auth.
"""
- r = Request(method='POST', url=url, data=data, headers=headers, files=files, cookiejar=cookies, auth=_detect_auth(url, auth))
+ r = Request(method='POST', url=url, data=data, headers=headers,
+ files=files, cookiejar=cookies, auth=_detect_auth(url, auth))
r.send()
return r.response
:param auth: (optional) AuthObject to enable Basic HTTP Auth.
"""
- r = Request(method='PUT', url=url, data=data, headers=headers, files=files, cookiejar=cookies, auth=_detect_auth(url, auth))
+ r = Request(method='PUT', url=url, data=data, headers=headers, files=files,
+ cookiejar=cookies, auth=_detect_auth(url, auth))
r.send()
return r.response
:param auth: (optional) AuthObject to enable Basic HTTP Auth.
"""
- r = Request(method='DELETE', url=url, params=params, headers=headers, cookiejar=cookies, auth=_detect_auth(url, auth))
+ r = Request(method='DELETE', url=url, params=params, headers=headers,
+ cookiejar=cookies, auth=_detect_auth(url, auth))
r.send()
return r.response
class RequestException(Exception):
- """There was an ambiguous exception that occured while handling your request."""
+ """There was an ambiguous exception that occured while handling your
+ request."""
class AuthenticationError(RequestException):
"""The authentication credentials provided were invalid."""