rewind_body() — requests Function Reference
Architecture documentation for the rewind_body() function in utils.py from the requests codebase.
Entity Profile
Dependency Diagram
graph TD e679c8f8_c181_cd54_e322_bcb974be7211["rewind_body()"] 2c39b9da_e317_5e6c_bbac_8362bac2110c["utils.py"] e679c8f8_c181_cd54_e322_bcb974be7211 -->|defined in| 2c39b9da_e317_5e6c_bbac_8362bac2110c cbf6862f_d124_817f_3342_f1142c276f25["resolve_redirects()"] cbf6862f_d124_817f_3342_f1142c276f25 -->|calls| e679c8f8_c181_cd54_e322_bcb974be7211 style e679c8f8_c181_cd54_e322_bcb974be7211 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
src/requests/utils.py lines 1069–1084
def rewind_body(prepared_request):
"""Move file pointer back to its recorded starting position
so it can be read again on redirect.
"""
body_seek = getattr(prepared_request.body, "seek", None)
if body_seek is not None and isinstance(
prepared_request._body_position, integer_types
):
try:
body_seek(prepared_request._body_position)
except OSError:
raise UnrewindableBodyError(
"An error occurred when rewinding request body for redirect."
)
else:
raise UnrewindableBodyError("Unable to rewind request body for redirect.")
Domain
Subdomains
Defined In
Called By
Source
Frequently Asked Questions
What does rewind_body() do?
rewind_body() is a function in the requests codebase, defined in src/requests/utils.py.
Where is rewind_body() defined?
rewind_body() is defined in src/requests/utils.py at line 1069.
What calls rewind_body()?
rewind_body() is called by 1 function(s): resolve_redirects.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free