Replies: 3 comments
-
Are you sure you're running the latest version of mypy (1.4) and have the latest version of Here's a minimal, self-contained code sample: import httpx
httpx.get("https://example.com", headers={"one": "two"}) |
Beta Was this translation helpful? Give feedback.
-
Sorry, I should have shown my real code, but youre reply made me think.... This is working...
but not this
|
Beta Was this translation helpful? Give feedback.
-
Okj, it is the last assignment, if I use self.config.get("client_id", "") it works. Sorry that I did not try this before, it makes a lot of sense that this throws an error. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi, I guess this is a pretty simple question, but I cannot figure it out. I am using the httpx.get method and want to specify headers. My call (simplified) looks like this...
httpx.get("https://example.com", headers={"one": "two"})
Mypy is complaining with the following error...
Argument "headers" to "get" of "Client" has incompatible type "dict[str, str|None]"; expexted "Headers| Mapping[str, str,]| Mapping[bytes, bytes]|Sequence[tuple[str, str]]| Sequence[tuple[bytes,bytes]] | None
The code works and I can "fix" this issue by specifying a variable as Mapping[str,str] first and then using it, but I think this is a little bit too complex, is there a better solution for this?
Beta Was this translation helpful? Give feedback.
All reactions