MCPcopy
hub / github.com/openai/openai-python / _prepare_url

Method _prepare_url

src/openai/_base_client.py:482–493  ·  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

480 return headers
481
482 def _prepare_url(self, url: str) -> URL:
483 """
484 Merge a URL argument together with any 'base_url' on the client,
485 to create the URL used for the outgoing request.
486 """
487 # Copied from httpx's `_merge_url` method.
488 merge_url = URL(url)
489 if merge_url.is_relative_url:
490 merge_raw_path = self.base_url.raw_path + merge_url.raw_path.lstrip(b"/")
491 return self.base_url.copy_with(raw_path=merge_raw_path)
492
493 return merge_url
494
495 def _make_sse_decoder(self) -> SSEDecoder | SSEBytesDecoder:
496 return SSEDecoder()

Callers 1

_build_requestMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected