I\'m working with wechat APIs ...
here I\'ve to upload an image to wechat\'s server using this API
http://admin.wechat.com/wiki/index.php?title=Transferring_Multimedia_Files
import os
import requests
url = 'http://host:port/endpoint'
with open(path_img, 'rb') as img:
name_img= os.path.basename(path_img)
files= {'image': (name_img,img,'multipart/form-data',{'Expires': '0'}) }
with requests.Session() as s:
r = s.post(url,files=files)
print(r.status_code)