python如何安装requests模块


当前第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模块的详细内容,更多文章请关注木庄网络博客!!

返回前面的内容

相关阅读 >>

tensorflow基础(机器学习开源软件库)

Python有什么好书推荐

Python操作mysql的实例详解

Python怎么同时对多行代码进行注释

如何使用Python生成mac地址

Python3怎么装pip

Python的int是什么

Python文件的三种可读可写模式的特点及区别

Python软件版本的下载方式

Python中fun是什么意思

更多相关阅读请进入《Python》频道 >>




打赏

取消

感谢您的支持,我会继续努力的!

扫码支持
扫码打赏,您说多少就多少

打开支付宝扫一扫,即可进行扫码打赏哦

分享从这里开始,精彩与您同在

评论

管理员已关闭评论功能...