]> git.ipfire.org Git - thirdparty/httpx.git/commitdiff
update requests compatibility docs on query and form params (#2461)
authorBen Falk <falk.ben@gmail.com>
Fri, 25 Nov 2022 12:05:46 +0000 (07:05 -0500)
committerGitHub <noreply@github.com>
Fri, 25 Nov 2022 12:05:46 +0000 (12:05 +0000)
docs/compatibility.md

index de8f701702bbac08e49d27094dd5e754c57556c3..b2092477e84747217e3e94d420bd0721ffcf6f0f 100644 (file)
@@ -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`.