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

_prepare_url() — anthropic-sdk-python Function Reference

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

Entity Profile

Dependency Diagram

graph TD
  4d73bd62_047b_924c_524a_7c9b60a2ca98["_prepare_url()"]
  842ce0be_ea56_b939_960f_13eb61230daf["BaseClient"]
  4d73bd62_047b_924c_524a_7c9b60a2ca98 -->|defined in| 842ce0be_ea56_b939_960f_13eb61230daf
  c1255cc8_bc9d_85e2_d7e7_d99e63ebb389["_build_request()"]
  c1255cc8_bc9d_85e2_d7e7_d99e63ebb389 -->|calls| 4d73bd62_047b_924c_524a_7c9b60a2ca98
  style 4d73bd62_047b_924c_524a_7c9b60a2ca98 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

src/anthropic/_base_client.py lines 474–485

    def _prepare_url(self, url: str) -> URL:
        """
        Merge a URL argument together with any 'base_url' on the client,
        to create the URL used for the outgoing request.
        """
        # Copied from httpx's `_merge_url` method.
        merge_url = URL(url)
        if merge_url.is_relative_url:
            merge_raw_path = self.base_url.raw_path + merge_url.raw_path.lstrip(b"/")
            return self.base_url.copy_with(raw_path=merge_raw_path)

        return merge_url

Subdomains

Called By

Frequently Asked Questions

What does _prepare_url() do?
_prepare_url() is a function in the anthropic-sdk-python codebase, defined in src/anthropic/_base_client.py.
Where is _prepare_url() defined?
_prepare_url() is defined in src/anthropic/_base_client.py at line 474.
What calls _prepare_url()?
_prepare_url() is called by 1 function(s): _build_request.

Analyze Your Own Codebase

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

Try Supermodel Free