I have send requests with python to upload file.
When I don't add content-type in heards, I can success upload file:
import requests
import csv
import os
url = "https://url/upload/"
headers = {
'authority': 'https://url/',
}
csv_file_path = os.getcwd() + r"\xxx.csv"
files = {
"file": open(csv_file_path, "rb")
}
response = requests.post(url, headers=headers, files=files)
print(response.text.encode('utf8'))
But if I add 'content-type': 'multipart/form-data'
(get it from browser) in headers, will upload fail(500 error).
Why can't using this content-type? what is correct content-type?
Thank for answer!