Python requests模块
来源:互联网 发布:dnf为什么老是网络中断 编辑:程序博客网 时间:2024/05/17 07:08
____tz_zs笔记
requests 模块是一个简洁且简单的处理HTTP请求的工具,支持非常丰富的链接访问功能,包括URL获取, HTTP会话,Cookie记录等。requests 是三方的库(比 Python 自带的 urllib 和 urllib2 好用),所以要先安装(pip install requests)才能使用。
官方文档: http://docs.python-requests.org/en/master/
中文文档: http://cn.python-requests.org/zh_CN/latest/
请求方式
get() 对应HTTP的GET方式
post() 对应HTTP的POST方式,用于传递用户数据
...
>>> import requests>>> r = requests.get('https://github.com/timeline.json')>>> r = requests.post("http://httpbin.org/post")>>> r = requests.put("http://httpbin.org/put")>>> r = requests.delete("http://httpbin.org/delete")>>> r = requests.head("http://httpbin.org/get")>>> r = requests.options("http://httpbin.org/get")
response对象的属性
status_code HTTP请求的返回状态,200表示连接成功,400表示失败
text HTTP相应内容的字符串形式,即url对应的页面内容
...
ps:所有的内容都在官方文档里有,还是读文档吧 http://cn.python-requests.org/zh_CN/latest/user/quickstart.html#id2
附:其他作者关于 requests 的博客,有代码示例 http://blog.csdn.net/nicewuranran/article/details/52060125
阅读全文
0 0
- Python模块学习 - Requests
- python requests 模块学习
- Python Requests模块
- python 3 requests模块
- Python requests模块详解
- Python requests模块
- python 3 requests模块
- python 的requests模块
- Python requests模块
- 【爬虫】Python的Requests模块
- Python 外部模块requests 安装
- python中的requests模块错误
- Python requests模块的学习
- Python网络请求模块requests
- python中的requests模块学习
- python模块之requests学习
- python的requests 模块使用方法
- Python requests模块学习笔记
- 集合数据类型的操作
- cf723D 连通块
- 阿里云短信验证
- 论苹果与安卓系统争霸
- 哥德尔定理的正规表述
- Python requests模块
- 微软超融合+混合云:源自Azure技术的超融合架构
- 金融二叉树模型-给期权定价
- Oracle之虚拟索引
- C++泛型编程----(二)模板类
- Hadoop概念学习系列之Hadoop、Spark学习路线(很值得推荐)
- angular中的$on、$emit、$broadcast
- Oracle之索引监控脚本大全
- Android 定制的旋转太阳的下拉刷新样式