Regarding the issue where response 500 is returned when uploading a file
回答済みDear Customer Support
This is Kyosuke from Baroque Japan Limited based in Japan.
When I upload a file using the program below, a <response 500> is returned.
How can I modify it so that I can upload the file?
■Source code
with open(fr"C:\408138_20231115.PDF", 'rb') as f:
files = f.read()
binary_file_b64 = base64.b64encode(files)
SendFile_ep = fr"https://upload.box.com/api/2.0/files/content"
headers = {'Authorization': 'Bearer {}'.format(AccessToken)}
payload = {
'attributes': {
'content_created_at': '',
'content_modified_at': '',
'name': fr"408138_20231115.PDF",
'parent': {
'id': fr"241581751084"
}
},
'file': fr"{binary_file_b64}"
}
res = requests.post(SendFile_ep, payload, headers=headers)
code = res.status_code
if code == 200 :
print(f"Success to post files : \n{res.text}\n")
else :
print(f"Failure to post files : \n{res.text}\n")
sys.exit(code)
■responce text
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=ISO-8859-1"/>
<title>Error 500 </title>
</head>
<body>
<h2>HTTP ERROR: 500</h2>
<p>Problem accessing /api/2.0/files/content. Reason:
<pre> java.lang.IllegalStateException: Form too large: 435195 > 200000</pre></p>
<hr /><i><small>Powered by Jetty://</small></i>
</body>
</html>
サインインしてコメントを残してください。
コメント
1件のコメント