python 爬虫 requests 错误汇总

本文总结了使用Python requests库进行爬虫时可能遇到的错误,包括ProxyError(代理错误)、InsecureRequestWarning(SSL警告)、ConnectionError(连接错误)、ReadTimeout(读取超时)和TooManyRedirects(重定向过多)。针对这些问题,提供了相应的解决办法和参考资料。
摘要由CSDN通过智能技术生成

1、发生异常: ProxyError

  • HTTPSConnectionPool(host=‘www.baidu.com’, port=443): Max retries exceeded with url: /s?ie=UTF-8&wd=free (Caused by ProxyError(‘Cannot connect to proxy.’, OSError(‘Tunnel connection failed: 407 Proxy Authentication Required’)))
    File “D:\github\python\jav_baidu_reptiles\text2.py”, line 53, in get_baidu_wd
    r = requests.get(
    File “D:\github\python\jav_baidu_reptiles\text2.py”, line 131, in
    get_baidu_wd(item,‘free’)
>-  原因分析:使用的代理有问题`Cannot connect to proxy`

2、ssl警告

  • C:\Users\wjt\AppData\Local\Programs\Python\Python39\lib\site-packages\urllib3\connectionpool.py:981: InsecureRequestWarning: Unverified HTTPS request is being made to host ‘1.199.6.141’. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/lates
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值