I swear to the LMS gods that the following Python requests code was working just yesterday:
import requests
filename = 'test.svg'
folderPath = '/myFolder/test'
size = os.path.getsize(filename)
data = { 'name' : filename,
'size' : str(size),
'content_type' : 'image/svg+xml',
'parent_folder_path' : folderPath }
response = requests.post(filesURL, json=data, headers=headers)
response.raise_for_status()
response = response.json()
files = list(response['upload_params'].items())
file_content = open('svg/'+filename, 'rb').read()
files.append((u'file', file_content))
response = requests.post(response['upload_url'], files=files)
response.raise_for_status()
id = str(response.json()['id'])
However, in step 1, when I get the first response, it looks nothing like it used to or what's in the documentation:
{
'file_param': 'file',
'progress': None,
'upload_url': 'https://inst-fs-iad-prod.inscloudgate.net/files?token=<crazy long token>',
'upload_params':
{
'filename': 'c02s04n02a.svg',
'content_type': 'image/svg+xml'
}
}
The code produces the following error:
500 Server Error: Internal Server Error for url: https://inst-fs-iad-prod.inscloudgate.net/files?token=<blah etc.>
Am I missing something? Has a change of file repository occurred from AWS?
Would appreciate some help!
Thanks