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

Method merge

httpx/_urls.py:582–598  ·  httpx/_urls.py::QueryParams.merge

Return a new QueryParams instance, updated with. Usage: q = httpx.QueryParams("a=123") q = q.merge({"b": "456"}) assert q == httpx.QueryParams("a=123&b=456") q = httpx.QueryParams("a=123") q = q.merge({"a": "456", "b": "789"}) asser

(self, params: QueryParamTypes | None = None)

Source from the content-addressed store, hash-verified

580 return q
581
582 def merge(self, params: QueryParamTypes | None = None) -> QueryParams:
583 class="st">"""
584 Return a new QueryParams instance, updated with.
585
586 Usage:
587
588 q = httpx.QueryParams(class="st">"a=123")
589 q = q.merge({class="st">"b": class="st">"456"})
590 assert q == httpx.QueryParams(class="st">"a=123&b=456")
591
592 q = httpx.QueryParams(class="st">"a=123")
593 q = q.merge({class="st">"a": class="st">"456", class="st">"b": class="st">"789"})
594 assert q == httpx.QueryParams(class="st">"a=456&b=789")
595 class="st">"""
596 q = QueryParams(params)
597 q._dict = {**self._dict, **q._dict}
598 return q
599
600 def __getitem__(self, key: typing.Any) -> str:
601 return self._dict[key][0]

Callers 3

_merge_queryparamsMethod · 0.95
test_queryparam_mergeFunction · 0.95
copy_merge_paramsMethod · 0.80

Calls 1

QueryParamsClass · 0.85

Tested by 1

test_queryparam_mergeFunction · 0.76