From: Kenneth Reitz Date: Mon, 14 Feb 2011 17:52:15 +0000 (-0500) Subject: Added Cookies documentation. X-Git-Tag: v0.2.2^2~1^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=98c8a78c3e0f3827ef4ba304de9fa74666f0be0e;p=services%2Fpython-requests.git Added Cookies documentation. --- diff --git a/README.rst b/README.rst index b18557d..9b987ef 100644 --- a/README.rst +++ b/README.rst @@ -56,27 +56,28 @@ API **Requests:** All request functions return a Response object (see below). + +If a {filename: fileobject} dictionary is passed in (files=...), a multipart_encode upload will be performed. +If CookieJar object is is passed in (cookies=...), the cookies will be sent with the request. GET Requests - >>> request.get(url, params={}, headers={} auth=None) + >>> request.get(url, params={}, headers={}, cookies=None, auth=None) HEAD Requests - >>> request.head(url, params={}, headers={} auth=None) + >>> request.head(url, params={}, headers={}, cookies=None, auth=None) PUT Requests - >>> request.put(url, data='', headers={}, files={}, auth=None) + >>> request.put(url, data='', headers={}, files={}, cookies=None, auth=None) - # If files dictionary ( {filename: fileobject, ...} ) is given, a multi-part upload is performed. POST Requests - >>> request.post(url, data={}, headers={}, files={}, auth=None) + >>> request.post(url, data={}, headers={}, files={}, cookies=None, auth=None) - # If files dictionary ( {filename: fileobject, ...} ) is given, a multi-part upload is performed. DELETE Requests - >>> request.delete(url, params={}, headers={}, auth=None) + >>> request.delete(url, params={}, headers={}, cookies=None, auth=None) diff --git a/requests/core.py b/requests/core.py index e935032..28d0505 100644 --- a/requests/core.py +++ b/requests/core.py @@ -288,7 +288,8 @@ def get(url, params={}, headers={}, cookies=None, auth=None): :param url: URL for the new :class:`Request` object. :param params: (optional) Dictionary of GET Parameters to send with the :class:`Request`. - :param headers: (optional) Dictionary of HTTP Headers to sent with the :class:`Request`. + :param headers: (optional) Dictionary of HTTP Headers to send with the :class:`Request`. + :param cookies: (optional) CookieJar object to send with the :class:`Request`. :param auth: (optional) AuthObject to enable Basic HTTP Auth. """ @@ -312,6 +313,7 @@ def head(url, params={}, headers={}, cookies=None, auth=None): :param url: URL for the new :class:`Request` object. :param params: (optional) Dictionary of GET Parameters to send with the :class:`Request`. :param headers: (optional) Dictionary of HTTP Headers to sent with the :class:`Request`. + :param cookies: (optional) CookieJar object to send with the :class:`Request`. :param auth: (optional) AuthObject to enable Basic HTTP Auth. """ @@ -337,6 +339,7 @@ def post(url, data={}, headers={}, files=None, cookies=None, auth=None): :param data: (optional) Dictionary of POST Data to send with the :class:`Request`. :param headers: (optional) Dictionary of HTTP Headers to sent with the :class:`Request`. :param files: (optional) Dictionary of 'filename': file-like-objects for multipart encoding upload. + :param cookies: (optional) CookieJar object to send with the :class:`Request`. :param auth: (optional) AuthObject to enable Basic HTTP Auth. """ @@ -365,6 +368,7 @@ def put(url, data='', headers={}, files={}, cookies=None, auth=None): :param data: (optional) Bytes of PUT Data to send with the :class:`Request`. :param headers: (optional) Dictionary of HTTP Headers to sent with the :class:`Request`. :param files: (optional) Dictionary of 'filename': file-like-objects for multipart encoding upload. + :param cookies: (optional) CookieJar object to send with the :class:`Request`. :param auth: (optional) AuthObject to enable Basic HTTP Auth. """ @@ -389,6 +393,7 @@ def delete(url, params={}, headers={}, cookies=None, auth=None): :param url: URL for the new :class:`Request` object. :param params: (optional) Dictionary of GET Parameters to send with the :class:`Request`. :param headers: (optional) Dictionary of HTTP Headers to sent with the :class:`Request`. + :param cookies: (optional) CookieJar object to send with the :class:`Request`. :param auth: (optional) AuthObject to enable Basic HTTP Auth. """