From 8e5e3b871be2eb05f3c0775940fc32e266f3122d Mon Sep 17 00:00:00 2001 From: Ben Falk Date: Fri, 25 Nov 2022 07:05:46 -0500 Subject: [PATCH] update requests compatibility docs on query and form params (#2461) --- docs/compatibility.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/compatibility.md b/docs/compatibility.md index de8f701702..b2092477e8 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`.