3👍
✅
Try this:
with open('test.jpg', 'rb') as payload:
files = {
'photo': payload,
'Content-Type': 'image/jpeg'
}
r = requests.put(
'http://localhost:8000/sendfiles/1/',
verify=False, files=files
)
print(r)
Requests will see that “files” parameter has content and will set the headers accordingly.
Source:stackexchange.com