0

I have a request.args that is ImmutableMultiDict, which means that some keys appears more than once, for example:

[('email', 'abc@gmail.com'), ('service', 'first'), ('service', 'second'), ('service', 'third')]

When I used the dict function in Python 3.6.3 and called:

dict(request.args)

I got:

{'email':['abc@gmail.com'], 'service':['first','second','third']}

So I could iterate over the different values of services using:

dict(request.args)['service']

But after I upgrade to the python 3.6.8, the dict(request.args) returns:

{'email': 'abc@gmail.con', 'service': 'first'}

and I lost all the other values of the service key.

Does anyone have an idea how to iterate those values using Python 3.6.8? Doing a simple request.args.get('service') also returns only the first matching element.

khelwood
  • 55,782
  • 14
  • 81
  • 108
Osnat
  • 107
  • 3
  • 11

0 Answers0