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

Allow to send list as a value for params in ClientSession #4929

Closed
paulefoe opened this issue Aug 22, 2020 · 4 comments
Closed

Allow to send list as a value for params in ClientSession #4929

paulefoe opened this issue Aug 22, 2020 · 4 comments

Comments

@paulefoe
Copy link
Member

🐣 Is your feature request related to a problem? Please describe.
In requests you can do something like this:
r.get('https://www.archlinux.org', params={'ids': [1,2,3,4,5,6]})
and the resulting url would be
https://www.archlinux.org/?ids=1&ids=2&ids=3&ids=4&ids=5&ids=6

The current behavior in aiohttp is to raise TypeError

TypeError: Invalid variable type: value should be str or int, got [1, 2, 3, 4, 5] of type <class 'list'>

💡 Describe the solution you'd like
My suggestion is to convert a list like this to list of tuples in the end, i.e.:

params={
   some: 1,
   list_ids: [1,2 ,3 ]
}

would look like this:

[('some', 1), ('list_ids', 1), ('list_ids', 2), ('list_ids', 3)]

📋 Additional context
If the community decides that this is desirable behavior I am more than willing to work on it.

@WolframAlph
Copy link
Member

@webknjaz is this the behaviour we want to have?

@webknjaz
Copy link
Member

I believe there's been something similar merged into yarl master recently. Check that out first.

@webknjaz
Copy link
Member

Try searching and linking related issues and PRs, if you find something.

@paulefoe
Copy link
Member Author

aio-libs/yarl#443
#4714

Yeah, here it is.

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

3 participants