Home / Function/ _prepare_request() — anthropic-sdk-python Function Reference

_prepare_request() — anthropic-sdk-python Function Reference

Architecture documentation for the _prepare_request() function in _client.py from the anthropic-sdk-python codebase.

Function python AnthropicClient AsyncAPI calls 2 called by 1

Entity Profile

Dependency Diagram

graph TD
  1a84c61a_f43c_16d5_287c_446adc194df6["_prepare_request()"]
  52b957ca_f6e2_8cc2_8b0b_1f00048d1b4f["AnthropicBedrock"]
  1a84c61a_f43c_16d5_287c_446adc194df6 -->|defined in| 52b957ca_f6e2_8cc2_8b0b_1f00048d1b4f
  69e337f6_5da7_c1c3_8d13_9a20707778ba["_prepare_request()"]
  69e337f6_5da7_c1c3_8d13_9a20707778ba -->|calls| 1a84c61a_f43c_16d5_287c_446adc194df6
  69e337f6_5da7_c1c3_8d13_9a20707778ba["_prepare_request()"]
  1a84c61a_f43c_16d5_287c_446adc194df6 -->|calls| 69e337f6_5da7_c1c3_8d13_9a20707778ba
  9e2a0427_3d5d_efdb_8832_2499da1e74c9["get_auth_headers()"]
  1a84c61a_f43c_16d5_287c_446adc194df6 -->|calls| 9e2a0427_3d5d_efdb_8832_2499da1e74c9
  style 1a84c61a_f43c_16d5_287c_446adc194df6 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

src/anthropic/lib/bedrock/_client.py lines 198–214

    def _prepare_request(self, request: httpx.Request) -> None:
        from ._auth import get_auth_headers

        data = request.read().decode()

        headers = get_auth_headers(
            method=request.method,
            url=str(request.url),
            headers=request.headers,
            aws_access_key=self.aws_access_key,
            aws_secret_key=self.aws_secret_key,
            aws_session_token=self.aws_session_token,
            region=self.aws_region or "us-east-1",
            profile=self.aws_profile,
            data=data,
        )
        request.headers.update(headers)

Subdomains

Called By

Frequently Asked Questions

What does _prepare_request() do?
_prepare_request() is a function in the anthropic-sdk-python codebase, defined in src/anthropic/lib/bedrock/_client.py.
Where is _prepare_request() defined?
_prepare_request() is defined in src/anthropic/lib/bedrock/_client.py at line 198.
What does _prepare_request() call?
_prepare_request() calls 2 function(s): _prepare_request, get_auth_headers.
What calls _prepare_request()?
_prepare_request() is called by 1 function(s): _prepare_request.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free