module documentation

This module implements the Requests API.

Unknown Field: copyright
  1. 2012 by Kenneth Reitz.
Unknown Field: license
Apache2, see LICENSE for more details.
Function delete Sends a DELETE request.
Function get Sends a GET request.
Function head Sends a HEAD request.
Function options Sends an OPTIONS request.
Function patch Sends a PATCH request.
Function post Sends a POST request.
Function put Sends a PUT request.
Function request Constructs and sends a Request.
def delete(url, **kwargs):
Sends a DELETE request.
Parameters
urlURL for the new Request object.
**kwargsOptional arguments that request takes.
Returns
requests.ResponseResponse object
def get(url, params=None, **kwargs):
Sends a GET request.
Parameters
urlURL for the new Request object.
params(optional) Dictionary, list of tuples or bytes to send in the query string for the Request.
**kwargsOptional arguments that request takes.
Returns
requests.ResponseResponse object
def head(url, **kwargs):
Sends a HEAD request.
Parameters
urlURL for the new Request object.
**kwargsOptional arguments that request takes. If allow_redirects is not provided, it will be set to False (as opposed to the default request behavior).
Returns
requests.ResponseResponse object
def options(url, **kwargs):
Sends an OPTIONS request.
Parameters
urlURL for the new Request object.
**kwargsOptional arguments that request takes.
Returns
requests.ResponseResponse object
def patch(url, data=None, **kwargs):
Sends a PATCH request.
Parameters
urlURL for the new Request object.
data(optional) Dictionary, list of tuples, bytes, or file-like object to send in the body of the Request.
**kwargsOptional arguments that request takes.
json(optional) json data to send in the body of the Request.
Returns
requests.ResponseResponse object
def post(url, data=None, json=None, **kwargs):
Sends a POST request.
Parameters
urlURL for the new Request object.
data(optional) Dictionary, list of tuples, bytes, or file-like object to send in the body of the Request.
json(optional) json data to send in the body of the Request.
**kwargsOptional arguments that request takes.
Returns
requests.ResponseResponse object
def put(url, data=None, **kwargs):
Sends a PUT request.
Parameters
urlURL for the new Request object.
data(optional) Dictionary, list of tuples, bytes, or file-like object to send in the body of the Request.
**kwargsOptional arguments that request takes.
json(optional) json data to send in the body of the Request.
Returns
requests.ResponseResponse object
def request(method, url, **kwargs):

Constructs and sends a Request.

Usage:

>>> import requests
>>> req = requests.request('GET', 'https://httpbin.org/get')
>>> req
<Response [200]>
Parameters
methodmethod for the new Request object: GET, OPTIONS, HEAD, POST, PUT, PATCH, or DELETE.
urlURL for the new Request object.
**kwargsUndocumented
timeout:float or tuple(optional) How many seconds to wait for the server to send data before giving up, as a float, or a :ref:`(connect timeout, read timeout) <timeouts>` tuple.
allow​_redirects:bool(optional) Boolean. Enable/disable GET/OPTIONS/POST/PUT/PATCH/DELETE/HEAD redirection. Defaults to True.
params(optional) Dictionary, list of tuples or bytes to send in the query string for the Request.
data(optional) Dictionary, list of tuples, bytes, or file-like object to send in the body of the Request.
json(optional) A JSON serializable Python object to send in the body of the Request.
headers(optional) Dictionary of HTTP Headers to send with the Request.
cookies(optional) Dict or CookieJar object to send with the Request.
files(optional) Dictionary of 'name': file-like-objects (or {'name': file-tuple}) for multipart encoding upload. file-tuple can be a 2-tuple ('filename', fileobj), 3-tuple ('filename', fileobj, 'content_type') or a 4-tuple ('filename', fileobj, 'content_type', custom_headers), where 'content-type' is a string defining the content type of the given file and custom_headers a dict-like object containing additional headers to add for the file.
auth(optional) Auth tuple to enable Basic/Digest/Custom HTTP Auth.
proxies(optional) Dictionary mapping protocol to the URL of the proxy.
verify(optional) Either a boolean, in which case it controls whether we verify the server's TLS certificate, or a string, in which case it must be a path to a CA bundle to use. Defaults to True.
stream(optional) if False, the response content will be immediately downloaded.
cert(optional) if String, path to ssl client cert file (.pem). If Tuple, ('cert', 'key') pair.
Returns
requests.ResponseResponse object