您的位置:首页 > 编程语言 > Python开发

python 发送上传文件multipart/form-data

2014-11-05 19:30 811 查看
{'Content-Length': '1913', 'Content-Type': 'multipart/form-data; 
 boundary=0985630fc9984fb2a0b534d9946a3544'}

from poster.encode import multipart_encode

from poster.streaminghttp import register_openers

import urllib2

#register_openers()

#datagen, headers = multipart_encode({"name":"1ceshi2ffDf","desc":"测试fff","uploadUtilName":"local-disk","postfix":".exe",\

#                                     "machineTypeIds":"1","version1":1,"version2":"x","version3":1,"version4":1,\

#                                     "attach":open("E:\\Python-Eclipse\\myfoscam\\result\\test_account.html","rb")})

#

#request=urllib2.Request("http://172.16.20.109:50002/firmware/add",datagen, headers)

#response=urllib2.urlopen(request).read()

#print response
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐