当前第2页 返回上一页
各种请求方式:
1 2 3 4 5 6 7 8 | import requests
requests.get('http://httpbin.org/get')
requests.post('http://httpbin.org/post')
requests.put('http://httpbin.org/put')
requests.delete('http://httpbin.org/delete')
requests.head('http://httpbin.org/get')
requests.options('http://httpbin.org/get')
|
基本的get请求
1 2 3 | import requests
response = requests.get('http://httpbin.org/get')print(response.text)
|
带参数的GET请求:
第一种直接将参数放在url内
1 2 3 | import requests
response = requests.get(http://httpbin.org/get?name=gemey&age=22)print(response.text)
|
解析json
1 2 3 4 5 6 | import requests
response = requests.get('http://httpbin.org/get')
print(response.text)
print(response.json()) #response.json()方法同json.loads(response.text)
print(type(response.json()))
|
以上就是python如何安装requests模块的详细内容,更多文章请关注木庄网络博客!!
返回前面的内容
相关阅读 >>
什么是Python类属性?类的私有属性是什么?(实例解析)
Python代码的打包与发布
Python写入已存在的excel数据实例
安装Python后怎么用
Python有这么强大吗
Python通过属性手段实现只允许调用一次的示例讲解_Python
Python灰帽子是什么
Python第三方库是什么
django中使用定时任务的两种方法介绍
Python如何使用unittest测试接口_Python
更多相关阅读请进入《Python》频道 >>
人民邮电出版社
python入门书籍,非常畅销,超高好评,python官方公认好书。
转载请注明出处:木庄网络博客 » python如何安装requests模块