Request#

class requests_cache.models.request.CachedRequest(body=None, cookies=_Nothing.NOTHING, headers=_Nothing.NOTHING, method=None, url=None)[source]#

Bases: RichMixin

A serializable dataclass that emulates requests.PreparedResponse

Parameters:
body: bytes#
cookies: RequestsCookieJar#
copy()[source]#

Return a copy of the CachedRequest

Return type:

CachedRequest

classmethod from_request(original_request)[source]#

Create a CachedRequest based on an original request object

Parameters:

original_request (PreparedRequest) –

Return type:

CachedRequest

headers: CaseInsensitiveDict#
method: str#
property path_url#
prepare()[source]#

Convert the CachedRequest back into a PreparedRequest

Return type:

PreparedRequest

url: str#