目录

requests如何发送get请求?

目录

官方文档

使用requests发送请求其实非常简单。

首先导入Requests模块

>>> import requests

下面试着去发送具体的请求,比如获取github的timeline信息

r = requests.get('https://api.github.com/events')

r是requests的响应(Response)对象,我们可以从r里面获取各种信息,比如获取响应的内容print(r.text)

原始封面

https://images.unsplash.com/photo-1513470270416-d3ff6f16b22f?w=300