在python爬虫中,requests库是一个常用的用于http请求的模块,可以方便的对网页进行爬取,是python爬取网页最好的库。当我们使用requests库,发起请求访问一个网页,就能很快的获取到html源文件,爬取我们需要的东西。本文将向大家介绍requests库的安装过程。
1、相关链接
官方文档:http://cn.python-requests.org
源代码地址:https://github.com/kennethreitz/requests
下载地址:https://github.com/mozilla/geckodriver/releases
2、利用 pip 安装
pip install requests
3、验证安装
在windows平台以管理员身份运行cmd验证安装
import requests
>>> r=requests.get("http://www.baidu.com")
>>> r.status_code
200
>>> r.encoding="utf-8"
>>> r.text以上就是python爬虫中requests的安装过程,希望能帮助到大家安装使用哦~更多python爬虫利器推荐:python利器教程。



