I use Requests to do some requests to an api. I want to pass multiple value to a request parameter so I use a list like this:
params = {'test_key': [value1, value2]}
requests.get('example.com', params = params)
The problem is that the module converts that into "example.com?test_key=value1&test_key=value2". The api I use do not accept this format but wants something like "example.com?test_key=value1,value2"
How can I achieve that ?
CodePudding user response:
As discussed in the comment section, using ','.join([value1, value2])
produces the desired string.