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

Method add

httpx/_urls.py:552–565  ·  httpx/_urls.py::QueryParams.add

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

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

Source from the content-addressed store, hash-verified

550 return q
551
552 def add(self, key: str, value: typing.Any = None) -> QueryParams:
553 class="st">"""
554 Return a new QueryParams instance, setting or appending the value of a key.
555
556 Usage:
557
558 q = httpx.QueryParams(class="st">"a=123")
559 q = q.add(class="st">"a", class="st">"456")
560 assert q == httpx.QueryParams(class="st">"a=123&a=456")
561 class="st">"""
562 q = QueryParams()
563 q._dict = dict(self._dict)
564 q._dict[str(key)] = q.get_list(key) + [primitive_value_to_str(value)]
565 return q
566
567 def remove(self, key: str) -> QueryParams:
568 class="st">"""

Callers 2

test_queryparam_addFunction · 0.95
copy_add_paramMethod · 0.80

Calls 3

get_listMethod · 0.95
QueryParamsClass · 0.85
primitive_value_to_strFunction · 0.85

Tested by 1

test_queryparam_addFunction · 0.76