class PreparedRequest(RequestEncodingMixin, RequestHooksMixin):
The fully mutable PreparedRequest
object,
containing the exact bytes that will be sent to the server.
Instances are generated from a 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]>
Static Method | _get_idna_encoded_host |
Undocumented |
Method | __init__ |
Undocumented |
Method | __repr__ |
Undocumented |
Method | copy |
Undocumented |
Method | prepare |
Prepares the entire request with the given parameters. |
Method | prepare_auth |
Prepares the given HTTP auth data. |
Method | prepare_body |
Prepares the given HTTP body data. |
Method | prepare_content_length |
Prepare Content-Length header based on request method and body |
Method | prepare_cookies |
Prepares the given HTTP cookie data. |
Method | prepare_headers |
Prepares the given HTTP headers. |
Method | prepare_hooks |
Prepares the given hooks. |
Method | prepare_method |
Prepares the given HTTP method. |
Method | prepare_url |
Prepares the given HTTP URL. |
Instance Variable | _body_position |
Undocumented |
Instance Variable | _cookies |
Undocumented |
Instance Variable | body |
Undocumented |
Instance Variable | headers |
Undocumented |
Instance Variable | hooks |
Undocumented |
Instance Variable | method |
Undocumented |
Instance Variable | url |
Undocumented |
Inherited from RequestEncodingMixin
:
Static Method | _encode_files |
Build the body for a multipart/form-data request. |
Static Method | _encode_params |
Encode parameters in a piece of data. |
Property | path_url |
Build the path URL to use. |
Inherited from RequestHooksMixin
:
Method | deregister_hook |
Deregister a previously registered hook. Returns True if the hook existed, False if not. |
Method | register_hook |
Properly register a hook. |
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
PreparedRequest
object. Any subsequent calls
to prepare_cookies will have no actual effect, unless the "Cookie"
header is removed beforehand.