Upload Image using POST form data in Python-requests
From wechat api doc: curl -F media=@test.jpg “http://file.api.wechat.com/cgi-bin/media/upload?access_token=ACCESS_TOKEN&type=TYPE” Translate the command above to python: import requests url=”http://file.api.wechat.com/cgi-bin/media/upload?access_token=ACCESS_TOKEN&type=TYPE” files = {‘media’: open(‘test.jpg’, ‘rb’)} requests.post(url, files=files) Doc: https://docs.python-requests.org/en/master/user/quickstart/#post-a-multipart-encoded-file