def upload():
r = requests.post(
url='http://upload.renren.com/upload.fcgi?pagetype=addpublishersingle&hostid=967004081&'
'callback=window.parent.handlePhotoData&uploadid=profile_publisher_photo_1540215890321',
data= {
"upload": "提交",
"__channel": "renren",
"privacyParams": '{"sourceControl": 99}',
'hostid': '967004081',
'requestToken': '-1124080368',
'_rtk': '88c0e36a'},
headers={'Conteny-Type': 'multipart/form-data'},
files={"file": ("wx.jpg", open("c:/wx.jpg", "rb"), "image/jpeg", {})},
cookies=login())
因此读取文件时需增加 文件名称wx.jpg 和 文件类型 "image/jpeg"