python利用requests框架 http请求
2015-07-20 15:53
519 查看
get请求:
url=URL
payload={'md5':md5}
r=requests.get(url,params=payload)
#print r.status_code
#print r.headers
return r.text
post请求,上传文件:
url=FILE_UPLOAD_URL
path="E:\Desert.jpg"
files={'file':open(path,'rb')}
response=requests.post(url,files=files)
print response
url=URL
payload={'md5':md5}
r=requests.get(url,params=payload)
#print r.status_code
#print r.headers
return r.text
post请求,上传文件:
url=FILE_UPLOAD_URL
path="E:\Desert.jpg"
files={'file':open(path,'rb')}
response=requests.post(url,files=files)
print response
相关文章推荐
- HttpClient模拟登录手机版微博
- zigbee06要怎么设置网络形式?星状网状树形这些网络要怎么才能建立?需要哪些设置呢?
- 网络IO之阻塞、非阻塞、同步、异步总结
- Python系列------httplib2--安装
- http://sass-lang.com/documentation/Sass/Script/Functions.html
- 解决Ubuntu Server 12.04换了网卡MAC地址后 网络不可用的问题.
- BZOJ3997: [TJOI2015]组合数学(网络流)
- Java基础—网络编程
- asp.net 5 如何使用ioc 以及在如何获取httpcontext对象
- Universal-Image-Loader,android-Volley,Picasso、Fresco和Glide五大Android开源组件加载网络图片的优缺点比较
- http 415 错误
- CA根证书制作【仅供参考】-----win7 windows server 2008R2下 https SSL证书安装的搭配(搭配https ssl本地测试环境)
- Linux中TCP连接过程状态简介
- 网络协议初探和Socket的使用
- tornado AsynHTTPClient.fetch() 发送POST json数据
- http配置文档简要说明(保留英文就说明)
- tcp/ip三次握手四次分手,撒手。。。。
- hdu 3572 Task Schedule(网络流最大流)
- TCP协议中的三次握手和四次挥手(图解)
- TCP协议三次握手过程分析