Skip to content
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

ClientSession post and get methods doesn't have full signature #4749

Open
paulefoe opened this issue May 16, 2020 · 1 comment
Open

ClientSession post and get methods doesn't have full signature #4749

paulefoe opened this issue May 16, 2020 · 1 comment

Comments

@paulefoe
Copy link
Member

🐣 Is your feature request related to a problem? Please describe.
It seems inconvenient that you don't know the signature of a method when using it. If you are coming from different libraries, like request or maybe you've used the aiohttp Client some time ago, you kinda know that there is probably params like auth, timeout, headers, and some other basic stuff, so it would be really convenient to not check the docs or source code, and have IDE to suggest you these params.
The other thing with this is that auth, for example, should be an instance of a BasicAuth, wherein requests it could be just a tuple. If we would have a signature beforehand, the IDE or mypy would be able to detect the error before executing the code.

💡 Describe the solution you'd like
One possibility is to duplicate the whole signature, instead of using kwargs. From the code perspective probably not the best idea, but it could help end-users.

Describe alternatives you've considered
I've also thought about making kwargs fully typed, but it doesn't look like mypy can handle this. I definitely can check this again if you think that this is a good idea.

📋 Additional context
Additionally, I would like to say that I'm willing to work on this if the community decides that this feature could add value to the project.
Thanks for the great library!

@Dreamsorcerer
Copy link
Member

Dreamsorcerer commented Nov 10, 2023

If anybody would like to work on this, we can now use Unpack with mypy 1.7:
https://docs.python.org/3/library/typing.html#typing.Unpack

This will allow us to specify all the kwarg types in one place and have them used for all the methods needed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants