Flask crashes with ValueError: too many values to unpack Flask crashes with ValueError: too many values to unpack flask flask

Flask crashes with ValueError: too many values to unpack


My best guess is that you return a special headers dictionary (from python-requests) instead of a normal one. Flask takes the headers in two forms:

{'key': 'value'}# and[('key', 'value')]

Since your special dict is not recognized as a real dict, it will be treated like a list of tuples, which fails.

Change

return r.text, r.status_code, r.headers

to

return r.text, r.status_code, r.headers.items()