import os
import requests
import json
import cv2
directory = r'C:\\boatlaunch'
for filename in os.listdir(directory):
if filename.endswith(".jpg") or filename.endswith(".jpge") or filename.endswith(".JPG"):
print(os.path.join(directory, filename))
filenamepath=os.path.join(directory, filename)
head={
'Authorization': 'fmetoken token=<mytoken>',
'Content-Disposition': 'attachment; filename="test.jpg"',
'Content-Type': 'application/octect-stream',
'Accept': 'application/json'
}
print(head)
filedata = open(filenamepath,'rb')
print(filedata)
res = requests.post(url,data=filedata,headers=head)
print(res.status_code)
print(res.text)
print(res.request.headers)