From: Ben Falk Date: Fri, 25 Nov 2022 12:05:46 +0000 (-0500) Subject: update requests compatibility docs on query and form params (#2461) X-Git-Tag: 0.23.2~30 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8e5e3b871be2eb05f3c0775940fc32e266f3122d;p=thirdparty%2Fhttpx.git update requests compatibility docs on query and form params (#2461) --- diff --git a/docs/compatibility.md b/docs/compatibility.md index de8f7017..b2092477 100644 --- a/docs/compatibility.md +++ b/docs/compatibility.md @@ -211,6 +211,8 @@ On the other hand, HTTPX uses [HTTPCore](https://github.com/encode/httpcore) as `requests` omits `params` whose values are `None` (e.g. `requests.get(..., params={"foo": None})`). This is not supported by HTTPX. +For both query params (`params=`) and form data (`data=`), `requests` supports sending a list of tuples (e.g. `requests.get(..., params=[('key1', 'value1'), ('key1', 'value2')])`). This is not supported by HTTPX. Instead, use a dictionary with lists as values. E.g.: `httpx.get(..., params={'key1': ['value1', 'value2']})` or with form data: `httpx.post(..., data={'key1': ['value1', 'value2']})`. + ## Event Hooks `requests` allows event hooks to mutate `Request` and `Response` objects. See [examples](https://requests.readthedocs.io/en/master/user/advanced/#event-hooks) given in the documentation for `requests`.