【python】ConnectionRefusedError: [WinError 10061]
2019-10-24 10:26
69 查看
在测试接口过程中,由于各种原因服务端返回:10061,由于目标计算机积极拒绝,无法连接。
图一
图二
造成这种返回结果的可能原因:
1、代码问题
2、本机代理设置问题
3、本地防火墙或者安全卫士之类的设置问题
3、目标服务没有启动,或者目标服务器挂掉
4、端口被占用
5、目标服务连接池已满
解决方法:
1、代码问题
修改或者添加网络代理程序,
使用了urllib、requests等库
设置HTTP_PROXY 和HTTPS_PROXY环境变量
常用的网络库会自动识别这些环境变量,使用变量设置的代理发起请求,设置如下:
import os os.environ['http_proxy'] = 'http://127.0.0.1:1080' os.environ['https_proxy'] = 'https://127.0.0.1:1080'
2、本机代理设置问题
点开浏览器中的设置,然后找到代理设置(谷歌浏览器里面此设置在高级里面),然后弹出internet属性-->网络代理设置,将自动检测设置中的自动检测打开。
3、端口被占用
修改目标服务器端口
查找占用端口的程序kill
4、服务器端问题
重启服务器
相关文章推荐
- Python网络请求错误“ConnectionRefusedError: [WinError 10061] 由于目标计算机积极拒绝,无法连接”
- Pycharm报错:ConnectionRefusedError: [WinError 10061] 由于目标计算机积极拒绝,无法连接。
- LR中winsock协议Error: "10061 - Connection refused"的解决方法
- LR中winsock协议Error: "10061 - Connection refused"的解决方法
- 【Python爬虫错误】ConnectionResetError: [WinError 10054] 远程主机强迫关闭了一个现有的连接
- 今天写一个JSP+Oracle的项目,遇到了 Listener refused the connection with the following error:ORA-12519:
- kvm 报错Error: viewer connection to hypervisor host got refused or disconnected!
- Hadoop Connection Refused Error
- python使用pip安装模块出现ReadTimeoutError: HTTPSConnectionPool的解决方法
- listener refused the connection with the following error:ORA-12519,TNS:no appropriate service handle
- Listener refused the connection with the following error:ORA-12505, TNS:listener does not currently
- ClientCnxn: Session 0x0 for server null, unexpected error Connection refused
- 异常:Listener refused the connection with the follow ing error:
- python爬虫 requests异常:requests.exceptions.ConnectionError: HTTPSConnectionPool Max retries exceeded
- Python使用post请求时遇到.ConnectionError: HTTPConnectionPool Max retries exceeded with url: Failed to esta
- pip install Error - ReadTimeoutError: HTTPSConnectionPool(host='pypi.python.org', port=443): Read
- Network error IOException: Connection refused: connect
- 状态: 失败 -测试失败: Listener refused the connection with the following error: ORA-12505, TNS:listener does
- centos 安装pysqlite-2.8.3.tar.gz src/connection.h:26:20: fatal error: Python.h: No such file or direct
- ERROR: opening port for MGR MGR (Connection refused).