我需要从客户端图像和一些数据(例如该图像的位置-> x,y)发送到服务器,但是没有任何作用。
headers = {'Content-Type': 'application/json'}
url = 'http://localhost:9886/images'
payload = {"username" : "Root", "role" : "Admin",
"image" : open('path_to_file/image.pgm', 'rb')}
payload_json = json.dumps(payload)
r = requests.post(url, data = payload_json, headers = headers)
有人回答简单吗?
文件= {'上传文件':打开('file.txt','rb')}] >>
r = requests.post(URL,files = files)