Skip to content
Advertisement

How to deal with ImmutableMultiDict

I’m trying to test my flask API with a POST request, but I have problems to deal with the ImmutableMultiDict.

The API:

JavaScript

request:

JavaScript

print(select):

JavaScript

How do I access the value (“ETH-PERP”) ?

I tried:

JavaScript

output: []

JavaScript

output: keyError: 0

JavaScript

output: 'dict_values' object is not subscriptable

any suggestions?

Advertisement

Answer

The problem is that the request data is not a form, it’s JSON.

You should probably use request.json to read it, which should give you a regular dictionary.

User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement