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

Method set

httpx/_urls.py:537–550  ·  httpx/_urls.py::QueryParams.set

Return a new QueryParams instance, setting the value of a key. Usage: q = httpx.QueryParams("a=123") q = q.set("a", "456") assert q == httpx.QueryParams("a=456")

(self, key: str, value: typing.Any = None)

Source from the content-addressed store, hash-verified

535 return list(self._dict.get(str(key), []))
536
537 def set(self, key: str, value: typing.Any = None) -> QueryParams:
538 class="st">"""
539 Return a new QueryParams instance, setting the value of a key.
540
541 Usage:
542
543 q = httpx.QueryParams(class="st">"a=123")
544 q = q.set(class="st">"a", class="st">"456")
545 assert q == httpx.QueryParams(class="st">"a=456")
546 class="st">"""
547 q = QueryParams()
548 q._dict = dict(self._dict)
549 q._dict[str(key)] = [primitive_value_to_str(value)]
550 return q
551
552 def add(self, key: str, value: typing.Any = None) -> QueryParams:
553 class="st">"""

Callers 2

test_queryparam_setFunction · 0.95
copy_set_paramMethod · 0.45

Calls 2

QueryParamsClass · 0.85
primitive_value_to_strFunction · 0.85

Tested by 1

test_queryparam_setFunction · 0.76