DeprecationWarning: HTTPResponse.getheader() is deprecated and will be removed in urllib3 v2.1.0. In

问题描述

报错描述,执行测试用例就有很多警告:DeprecationWarning: HTTPResponse.getheader() is deprecated and will be removed in urllib3 v2.1.0. Instead use

问题解决过程

1、根据网上资料提示,执行移除urllib3:

pip uninstall urllib3

移除后发现执行测试用例会提示缺少依赖包urllib

2、重新安装urllib3:

 pip install urllib3 -i http://mirrors.aliyun.com/pypi/simple --trusted-host mirrors.aliyun.com

安装时报错:

ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.
requests 2.28.2 requires urllib3<1.27,>=1.21.1, but you have urllib3 2.2.2 which is incompatible.
selenium 4.2.0 requires urllib3[secure,socks]~=1.26, but you have urllib3 2.2.2 which is incompatible.

分析问题与解决办法

此时发现是urllib3版本与现有环境不兼容,根据提示需要安全urllib3 v1.26版本

因此我直接在pycharm中使用工具安装指定版本的urllib3 v1.26,重新启动pycharm,问题解决了。

安装后

  • 5
    点赞
  • 7
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值