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

Method copy_with

httpx/_urls.py:327–340  ·  httpx/_urls.py::URL.copy_with

Copy this URL, returning a new URL with some components altered. Accepts the same set of parameters as the components that are made available via properties on the `URL` class. For example: url = httpx.URL("https://www.example.com").copy_with( u

(self, **kwargs: typing.Any)

Source from the content-addressed store, hash-verified

325 return not self.is_absolute_url
326
327 def copy_with(self, **kwargs: typing.Any) -> URL:
328 class="st">"""
329 Copy this URL, returning a new URL with some components altered.
330 Accepts the same set of parameters as the components that are made
331 available via properties on the `URL` class.
332
333 For example:
334
335 url = httpx.URL(class="st">"https://www.example.com").copy_with(
336 username=class="st">"jo@gmail.com", password=class="st">"a secret"
337 )
338 assert url == class="st">"https://jo%40email.com:a%20secret@www.example.com"
339 class="st">"""
340 return URL(self, **kwargs)
341
342 def copy_set_param(self, key: str, value: typing.Any = None) -> URL:
343 return self.copy_with(params=self.params.set(key, value))

Callers 15

copy_set_paramMethod · 0.95
copy_add_paramMethod · 0.95
copy_remove_paramMethod · 0.95
copy_merge_paramsMethod · 0.95
__init__Method · 0.95
_redirect_urlMethod · 0.95
test_copy_withFunction · 0.95
test_url_copywith_netlocFunction · 0.95

Calls 1

URLClass · 0.85

Tested by 15

test_copy_withFunction · 0.76
test_url_copywith_netlocFunction · 0.76
test_url_copywith_queryFunction · 0.76
test_jsonFunction · 0.36
test_binaryFunction · 0.36
test_redirectsFunction · 0.36