1

I'm trying to upload files to seafile server API.

Uploading files with Hebrew filenames return an error from the server when using requests.post. Request on fiddler-

'Content-Disposition: form-data; name:"file"; filename*=utf-8''b%27%5C.....'

Uploading files with Hebrew filenames manually succeed.

Request on fiddler-

'Content-Disposition: form-data; name:"file"; filename="בדיקה.docx" Content-Type: application/vnd.openxmlformats-officedocument.wordprocessingml.document"

Python code:

import requests


response = requests.post(
    upload_link, data={'filename': 'בדיקה.doc', 'parent_dir': '/'},
    files={'file': open('c:/Users/xiez/בדיקה.doc', 'rb')},
    headers={'Authorization': 'Token {token}'. format(token=token)}
)

Server response:

502 Bad Gateway The proxy server received an invalid response from an upstream server

Martin Gergov
  • 1,556
  • 4
  • 20
  • 29

0 Answers0