This function needs to send a JSON dict in python2.7 as a "file" using a post request but the script is running in a container and cannot write to disk.
The endpoint also cannot be changed to accept JSON, rather than a file, as its part of a larger project.
def _json_to_bucket(request_json, thing_id):
import json
import requests
request_url = "https://backend.com/thing/{}".format(thing_id)
data = {
'name': 'thing-{}'.format(datetime.isoformat(datetime.now())),
'url': '/thing_importer/',
'files': [json.loads(request_json)]
}
requests.post(request_url, data=data)