MCPcopy
hub / github.com/anthropics/anthropic-sdk-python / _prepare_url

Method _prepare_url

src/anthropic/_base_client.py:492–503  ·  view source on GitHub ↗

Merge a URL argument together with any 'base_url' on the client, to create the URL used for the outgoing request.

(self, url: str)

Source from the content-addressed store, hash-verified

490 return headers
491
492 def _prepare_url(self, url: str) -> URL:
493 """
494 Merge a URL argument together with any 'base_url' on the client,
495 to create the URL used for the outgoing request.
496 """
497 # Copied from httpx's `_merge_url` method.
498 merge_url = URL(url)
499 if merge_url.is_relative_url:
500 merge_raw_path = self.base_url.raw_path + merge_url.raw_path.lstrip(b"/")
501 return self.base_url.copy_with(raw_path=merge_raw_path)
502
503 return merge_url
504
505 def _make_sse_decoder(self) -> SSEDecoder | SSEBytesDecoder:
506 return SSEDecoder()

Callers 1

_build_requestMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected