'add base64 string as a file in Flask request

Variable photo contains an image in base64 string format I would like to create a Flask Request and use this string as a file,

fr = Request({})
fr.method = 'POST'
fr.root_path = root_path
fr.path = '/server/'
fr.headers = headers
fr.files = {'photo':photo} # This line needs to be corrected

would you please help how to add the string as a file.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source