You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I occasionally find myself making multiple URL.add method calls in a loop to add a list of values to the same query parameter name. If I'm not alone, perhaps it would be nice to add support for passing a list of values to URL.add?
For example:
>>># This currently returns a list of values.>>>values=URL.from_text('?foo=1&foo=2').get('foo')
>>>values
['1', '2']
>>># This is currently a TypeError>>>URL.add('foo', values)
URL.from_text('?foo=1&foo=2')
While looping over a single list and making multiple add calls isn't much effort, when working with a dictionary of parameters that I'd like to build a URL out of, and the dictionary may or may not have a list of values for some of the keys, I find the code needed to check each dictionary value and loop over the lists a bit messy.
Edit: I'm willing to put work into a PR for the feature, if the feature is considered a good addition.
The text was updated successfully, but these errors were encountered:
I occasionally find myself making multiple
URL.add
method calls in a loop to add a list of values to the same query parameter name. If I'm not alone, perhaps it would be nice to add support for passing a list of values toURL.add
?For example:
While looping over a single list and making multiple
add
calls isn't much effort, when working with a dictionary of parameters that I'd like to build a URL out of, and the dictionary may or may not have a list of values for some of the keys, I find the code needed to check each dictionary value and loop over the lists a bit messy.Edit: I'm willing to put work into a PR for the feature, if the feature is considered a good addition.
The text was updated successfully, but these errors were encountered: