class PreparedRequest(RequestEncodingMixin, RequestHooksMixin): (source)
The fully mutable :class:`PreparedRequest <PreparedRequest>` object, containing the exact bytes that will be sent to the server. Instances are generated from a :class:`Request <Request>` object, and should not be instantiated manually; doing so may produce undesirable effects. Usage:: >>> import requests >>> req = requests.Request('GET', 'https://httpbin.org/get') >>> r = req.prepare() >>> r <PreparedRequest [GET]> >>> s = requests.Session() >>> s.send(r) <Response [200]>
Method | __init__ |
Undocumented |
Method | __repr__ |
Undocumented |
Method | copy |
Undocumented |
Method | prepare |
Prepares the entire request with the given parameters. |
Method | prepare |
Prepares the given HTTP auth data. |
Method | prepare |
Prepares the given HTTP body data. |
Method | prepare |
Prepare Content-Length header based on request method and body |
Method | prepare |
Prepares the given HTTP cookie data. |
Method | prepare |
Prepares the given HTTP headers. |
Method | prepare |
Prepares the given hooks. |
Method | prepare |
Prepares the given HTTP method. |
Method | prepare |
Prepares the given HTTP URL. |
Instance Variable | body |
Undocumented |
Instance Variable | headers |
Undocumented |
Instance Variable | hooks |
Undocumented |
Instance Variable | method |
Undocumented |
Instance Variable | url |
Undocumented |
Static Method | _get |
Undocumented |
Instance Variable | _body |
Undocumented |
Instance Variable | _cookies |
Undocumented |
Inherited from RequestEncodingMixin
:
Property | path |
Build the path URL to use. |
Static Method | _encode |
Build the body for a multipart/form-data request. |
Static Method | _encode |
Encode parameters in a piece of data. |
Inherited from RequestHooksMixin
(via RequestEncodingMixin
):
Method | deregister |
Deregister a previously registered hook. Returns True if the hook existed, False if not. |
Method | register |
Properly register a hook. |
Prepares the entire request with the given parameters.
Prepares the given HTTP cookie data. This function eventually generates a ``Cookie`` header from the given cookies using cookielib. Due to cookielib's design, the header will not be regenerated if it already exists, meaning this function can only be called once for the life of the :class:`PreparedRequest <PreparedRequest>` object. Any subsequent calls to ``prepare_cookies`` will have no actual effect, unless the "Cookie" header is removed beforehand.