MCPcopy
hub / github.com/encode/httpx / join

Method join

httpx/_urls.py:354–366  ·  view source on GitHub ↗

Return an absolute URL, using this URL as the base. Eg. url = httpx.URL("https://www.example.com/test") url = url.join("/new/path") assert url == "https://www.example.com/new/path"

(self, url: URL | str)

Source from the content-addressed store, hash-verified

352 return self.copy_with(params=self.params.merge(params))
353
354 def join(self, url: URL | str) -> URL:
355 """
356 Return an absolute URL, using this URL as the base.
357
358 Eg.
359
360 url = httpx.URL("https://www.example.com/test")
361 url = url.join("/new/path")
362 assert url == "https://www.example.com/new/path"
363 """
364 from urllib.parse import urljoin
365
366 return URL(urljoin(str(self), str(URL(url))))
367
368 def __hash__(self) -> int:
369 return hash(str(self))

Callers 15

test_url_joinFunction · 0.95
test_relative_url_joinFunction · 0.95
test_url_join_rfc3986Function · 0.95
_build_auth_headerMethod · 0.80
_build_auth_headerMethod · 0.80
_build_auth_headerMethod · 0.80
__getitem__Method · 0.80
readMethod · 0.80
areadMethod · 0.80
textMethod · 0.80
readMethod · 0.80

Calls 1

URLClass · 0.85

Tested by 15

test_url_joinFunction · 0.76
test_relative_url_joinFunction · 0.76
test_url_join_rfc3986Function · 0.76
test_multipartFunction · 0.64
readMethod · 0.64
serve_in_threadFunction · 0.64
test_empty_contentFunction · 0.64