-
-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
The timeout
parameter of aiohttp.ClientSession
does work for types other than Union[ClientTimeout, _SENTINEL, None]
#8602
Comments
It's there for backwards compatibility, but shouldn't be used to ensure forward compatibility with v4. Therefore, it's not in the typing information. |
The documentation also has not mentioned |
Thanks for the feedback @Dreamsorcerer, we will just change our code to not pass a Technically, and somewhat pedantically, if you are following SEMVER, then |
I think we prefer the typing information to help nudge people away from deprecated things. The only reason you didn't have a type error before is because it was |
I encountered this issue as well upon a recent upgrade. I understand the motivation behind it, but I'm going to guess that there are a LOT of people who are using it with a |
Describe the bug
The typing for the
timeout
parameter ofaiohttp.ClientSession
isUnion[ClientTimeout, _SENTINEL, None]
aiohttp/aiohttp/client.py
Line 174 in f1e4213
but the function is written to also accommodate values for timeout that is of
float
type:aiohttp/aiohttp/client.py
Lines 1116 to 1124 in f1e4213
aiohttp/aiohttp/client.py
Lines 523 to 529 in f1e4213
aiohttp/aiohttp/client.py
Lines 185 to 191 in f1e4213
To Reproduce
Write some python code that passes a float/int value to
aiohttp.ClientSession.get(...,timeout=...)
and run mypy on it.Expected behavior
No type error as the code will run correctly.
Logs/tracebacks
Python Version
aiohttp Version
multidict Version
yarl Version
OS
Fedora Linux 40 (Xfce)
Related component
Server
Additional context
Code of Conduct
The text was updated successfully, but these errors were encountered: