获取请求:http.client.RemoteDisconnected:远程端关闭连接而没有响应

2024-03-29 10:47:55 发布

您现在位置:Python中文网/ 问答频道 /正文

我正在尝试执行一个GET请求,该请求位于我公司的代理防火墙下。authenationcan是SSO。为此,我提供用户名和密码。守则:

response = requests.get(url=url, proxies=proxiesDict, auth=HTTPBasicAuth(username, password))
print(response.status_code)

但我得到了以下错误:

 File "/usr/pkgs/python3/3.6.3/lib/python3.6/http/client.py", line 266, in _read_status
    raise RemoteDisconnected("Remote end closed connection without"
http.client.RemoteDisconnected: Remote end closed connection without response

如果我将timeout加上某个值(比如90),它将在90秒后杀死它。我知道用户名和密码是有效的,因为如果我更改密码中的一个字母,我会自动获得401状态码。为什么会这样?如何调试这样的问题


Tags: clienthttpurl密码getremoteresponsestatus