Python Post img
2016-03-16 16:45
561 查看
from poster.encode import multipart_encode from poster.streaminghttp import register_openers import urllib2 register_openers() #datagen, headers = multipart_encode({"Img": open("1.jpg", "rb")}) #request = urllib2.Request('http://192.168.0.158:806/API/Det', datagen, headers) #print urllib2.urlopen(request).read() #datagen, headers = multipart_encode( [("key", "value1"), ("key", "value2")] ) a=[ ('Img1', open('1.jpg', 'rb')) ,('Img2', open('2.jpg', 'rb')) ] datagen, headers = multipart_encode( a ) for i in range(100): request = urllib2.Request('http://192.168.0.158:806/API/TwoImage', datagen, headers) print urllib2.urlopen(request).read()
相关文章推荐
- python 安装MySQLdb模块
- python通过eval解析json
- python文件+文件夹操作
- Python ORM slqalchemy 中join的使用
- Python模块学习:urllib
- python str.format()方法的基本用法
- python连接mysql数据库
- python 正则表达式
- 使用R和Python计算AUC
- python abc II
- openerp js调用Python类方法
- Python的web小游戏启动心得
- 【python】:python学习的好资源
- 【python】:python学习的好资源
- 如何在Windows下开发Python:在cmd下运行Python脚本
- Python测试驱动编写
- python学习6 web开发
- 【算法】-8大排序算法总结-Python
- python面向对象高级编程
- 用numpy里的savetxt()