fake_useragent.errors.FakeUserAgentError: Maximum amount of retries reached解决方法!
UserAgent 就是用户代理,又叫报头,是一串字符串,相当于浏览器的身份证号,在利用爬虫爬取网站数据时,频繁更换它可以避免触发相应的反爬机制。
fake-useragent对频繁更换UserAgent提供了很好的支持,可谓防反扒利器。下面将介绍fake-useragent的安装到使用。
安装
pip install fake_useragent
用法
安装成功后,我们每次发送requests请求时通过random从中随机获取一个随机UserAgent,两行代码即可完成UserAgent的不停更换。
from fake_useragent import UserAgent
headers = {
"User-Agent":UserAgent().chrome
}
r = requests.get(url, proxies=proxies, headers=headers, timeout=10)
如果报错 :
fake_useragent.errors.FakeUserAgentError: Maximum amount of retries reached
fake_useragent中存储的UserAgent列表发生了变动,而本地UserAgent的列表未更新所导致的,在更新fake_useragent后报错就消失了。
按下Win +R 输入cmd 然后输入的下方代码即可
Pycharm 中选中下方Terminal然后输入如下代码即可
pip install -U fake-useragent

Python的其他包也可以用这种方法完成更新pip install -U 包名。
fake_useragent.errors.FakeUserAgentError: Maximum amount of retries reached解决方法!的更多相关文章
- FakeUserAgentError('Maximum amount of retries reached') 彻底解决办法
报错: FakeUserAgentError('Maximum amount of retries reached') 禁用服务器缓存: ua = UserAgent(use_cache_server ...
- 【python 爬虫】fake-useragent Maximum amount of retries reached解决方案
前言 在用fake-useragent的时候发生报错,fake_useragent.errors.FakeUserAgentError: Maximum amount of retries reach ...
- js中报错"Maximum call stack size exceeded"解决方法
Uncaught RangeError: Maximum call stack size exceeded 错误直译过来就是“栈溢出”,出现这个错误的原因是因为我进行了递归运算,但是忘记添加判断条件, ...
- SAP SOAMANAGER 配置WEBSERVICE 提示:Service cannot be reached解决方法
TM中有些服务没有被激活,以UI界面个性化设置化设置为例: 如果服务没有被激活,打开界面就会显示: 这时候右键点击属性,获取服务ID: 通过事务代码SICF,输入服务ID:wd_analyze_con ...
- Exceeded maximum number of retries. Exceeded max scheduling attempts 3 for instance
Exceeded maximum number of retries. Exceeded max scheduling attempts 3 for instance
- Exceeded maximum number of retries. Exceeded max scheduling attempts 3 for instance 7d90eb80-29e2-4238-b658-ade407ff9456. Last exception: [u'Traceback (most recent call last):\n', u' File "/usr/lib/py
Exceeded maximum number of retries. Exceeded max scheduling attempts 3 for instance 7d90eb80-29e2-42 ...
- passwd: Have exhausted maximum number of retries for service【转】
使用命令passwd修改密码时,遇到如下问题: # echo 'utf8'|passwd zhangsan --stdin Changing password for user zhangsan. p ...
- Error: 实例 "ddd" 执行所请求操作失败,实例处于错误状态。: 请稍后再试 [错误: Exceeded maximum number of retries. Exhausted all hosts available for retrying build failures for instance 6f60bc06-fcb6-4758-a46f-22120ca35a71.].
Error: 实例 "ddd" 执行所请求操作失败,实例处于错误状态.: 请稍后再试 [错误: Exceeded maximum number of retries. Exhaus ...
- passwd: Have exhausted maximum number of retries for service
使用命令passwd修改密码时,遇到如下问题:# echo 'utf8'|passwd zhangsan --stdinChanging password for user zhangsan.pass ...
随机推荐
- Prometheus监控神器-Rules篇
本章主要对如何使用Prometheus与Alertmanager组件集成配置,以及对警报规则 Rules 的俩种类型及其模板内容进行讲解. 与Alertmanager集成 Prometheus把产生的 ...
- NoisyStudent:
- Spring IOC 原理深层解析
1 Spring IOC概念认识 1.1 区别IOC与DI 首先我们要知道IOC(Inverse of Control:控制反转)是一种设计思想,就是 将原本在程序中手动创建对象的控制权,交由Spri ...
- 2020-04-07:说出Servlet的生命周期,并说出Servlet和CGI的区别。
Servlet的生命周期分为5个阶段:实例化:Servlet容器创建Servlet类的实例.初始化:该容器调用init()方法,通常会申请资源.服务:由容器调用service()方法,(也就是doGe ...
- CSS 点击img 或者 div 增加抖动(shake)效果
一般使用场景: 登录的错误验证 或者 强提醒 template 部分 <img id="barcode" :class="{ shaking: toShake}&q ...
- 使用 VMware Workstation Pro 让 PC 提供云桌面服务——学习笔记(二)
实验效果: 这次希望的效果是能够用远程桌面来实现 . 这里参考了博客 https://www.cnblogs.com/wwang/archive/2011/01/06/1928933.html 操作步 ...
- [netty4][netty-handler]netty之idle handler处理
初始化时记录idle时间,并启动一个延时任务,延时时间为idle时间,延时任务是io.netty.handler.timeout.IdleStateHandler.AllIdleTimeoutTask ...
- linux手动安装python
前提:你的linux服务器必须有gcc编译器,gcc查看方法:linux命令行>gcc -v 如果返回版本信息证明已经安装, 如果找不到命令,跳到这篇手动安装gcc >>> l ...
- 【Flutter 实战】一文学会20多个动画组件
老孟导读:此篇文章是 Flutter 动画系列文章第三篇,后续还有动画序列.过度动画.转场动画.自定义动画等. Flutter 系统提供了20多个动画组件,只要你把前面[动画核心](文末有链接)的文章 ...
- python thread的join与setDeamon
join t.start() t.join() Wait until the thread terminates. This blocks the calling thread until the t ...