PeterDing / BaiduPCS-Py

BaiduPCS API & App 百度网盘客户端 和 API
MIT License
698 stars 113 forks source link

PCS API Connection Reset #53

Open cinvro opened 3 years ago

cinvro commented 3 years ago

今天开始所有命令行功能都提示:

(v0.6.23) ERROR: BaiduPCSError: BaiduPCS._request
2021-07-09 18:34:05,155 | DEBUG | app: `app`: BaiduPCSError: Traceback (most recent call last):
  File "/Users/cinvro/Library/Python/3.8/lib/python/site-packages/urllib3/connectionpool.py", line 699, in urlopen
    httplib_response = self._make_request(
  File "/Users/cinvro/Library/Python/3.8/lib/python/site-packages/urllib3/connectionpool.py", line 382, in _make_request
    self._validate_conn(conn)
  File "/Users/cinvro/Library/Python/3.8/lib/python/site-packages/urllib3/connectionpool.py", line 1010, in _validate_conn
    conn.connect()
  File "/Users/cinvro/Library/Python/3.8/lib/python/site-packages/urllib3/connection.py", line 411, in connect
    self.sock = ssl_wrap_socket(
  File "/Users/cinvro/Library/Python/3.8/lib/python/site-packages/urllib3/util/ssl_.py", line 449, in ssl_wrap_socket
    ssl_sock = _ssl_wrap_socket_impl(
  File "/Users/cinvro/Library/Python/3.8/lib/python/site-packages/urllib3/util/ssl_.py", line 493, in _ssl_wrap_socket_impl
    return ssl_context.wrap_socket(sock, server_hostname=server_hostname)
  File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/ssl.py", line 500, in wrap_socket
    return self.sslsocket_class._create(
  File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/ssl.py", line 1040, in _create
    self.do_handshake()
  File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/ssl.py", line 1309, in do_handshake
    self._sslobj.do_handshake()
ConnectionResetError: [Errno 54] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/cinvro/Library/Python/3.8/lib/python/site-packages/requests/adapters.py", line 439, in send
    resp = conn.urlopen(
  File "/Users/cinvro/Library/Python/3.8/lib/python/site-packages/urllib3/connectionpool.py", line 755, in urlopen
    retries = retries.increment(
  File "/Users/cinvro/Library/Python/3.8/lib/python/site-packages/urllib3/util/retry.py", line 532, in increment
    raise six.reraise(type(error), error, _stacktrace)
  File "/Users/cinvro/Library/Python/3.8/lib/python/site-packages/urllib3/packages/six.py", line 769, in reraise
    raise value.with_traceback(tb)
  File "/Users/cinvro/Library/Python/3.8/lib/python/site-packages/urllib3/connectionpool.py", line 699, in urlopen
    httplib_response = self._make_request(
  File "/Users/cinvro/Library/Python/3.8/lib/python/site-packages/urllib3/connectionpool.py", line 382, in _make_request
    self._validate_conn(conn)
  File "/Users/cinvro/Library/Python/3.8/lib/python/site-packages/urllib3/connectionpool.py", line 1010, in _validate_conn
    conn.connect()
  File "/Users/cinvro/Library/Python/3.8/lib/python/site-packages/urllib3/connection.py", line 411, in connect
    self.sock = ssl_wrap_socket(
  File "/Users/cinvro/Library/Python/3.8/lib/python/site-packages/urllib3/util/ssl_.py", line 449, in ssl_wrap_socket
    ssl_sock = _ssl_wrap_socket_impl(
  File "/Users/cinvro/Library/Python/3.8/lib/python/site-packages/urllib3/util/ssl_.py", line 493, in _ssl_wrap_socket_impl
    return ssl_context.wrap_socket(sock, server_hostname=server_hostname)
  File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/ssl.py", line 500, in wrap_socket
    return self.sslsocket_class._create(
  File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/ssl.py", line 1040, in _create
    self.do_handshake()
  File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/ssl.py", line 1309, in do_handshake
    self._sslobj.do_handshake()
urllib3.exceptions.ProtocolError: ('Connection aborted.', ConnectionResetError(54, 'Connection reset by peer'))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/cinvro/Library/Python/3.8/lib/python/site-packages/baidupcs_py/baidupcs/pcs.py", line 195, in _request
    resp = self._session.request(
  File "/Users/cinvro/Library/Python/3.8/lib/python/site-packages/requests/sessions.py", line 542, in request
    resp = self.send(prep, **send_kwargs)
  File "/Users/cinvro/Library/Python/3.8/lib/python/site-packages/requests/sessions.py", line 655, in send
    r = adapter.send(request, **kwargs)
  File "/Users/cinvro/Library/Python/3.8/lib/python/site-packages/requests/adapters.py", line 498, in send
    raise ConnectionError(err, request=request)
requests.exceptions.ConnectionError: ('Connection aborted.', ConnectionResetError(54, 'Connection reset by peer'))

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/Users/cinvro/Library/Python/3.8/lib/python/site-packages/baidupcs_py/app/app.py", line 117, in wrap
    return func(*args, **kwargs)
  File "/Users/cinvro/Library/Python/3.8/lib/python/site-packages/baidupcs_py/app/app.py", line 463, in useradd
    account = Account.from_bduss(bduss, cookies=cookies)
  File "/Users/cinvro/Library/Python/3.8/lib/python/site-packages/baidupcs_py/app/account.py", line 38, in from_bduss
    user = api.user_info()
  File "/Users/cinvro/Library/Python/3.8/lib/python/site-packages/baidupcs_py/baidupcs/api.py", line 500, in user_info
    quota = self.quota()
  File "/Users/cinvro/Library/Python/3.8/lib/python/site-packages/baidupcs_py/baidupcs/api.py", line 84, in quota
    info = self._baidupcs.quota()
  File "/Users/cinvro/Library/Python/3.8/lib/python/site-packages/baidupcs_py/baidupcs/errors.py", line 136, in check
    info = func(*args, **kwargs)
  File "/Users/cinvro/Library/Python/3.8/lib/python/site-packages/baidupcs_py/baidupcs/pcs.py", line 223, in quota
    resp = self._request(Method.Get, url, params=params)
  File "/Users/cinvro/Library/Python/3.8/lib/python/site-packages/baidupcs_py/baidupcs/pcs.py", line 206, in _request
    raise BaiduPCSError("BaiduPCS._request", cause=err)
baidupcs_py.baidupcs.errors.BaiduPCSError: BaiduPCS._request
PeterDing commented 3 years ago

这个应该是你本地网络的问题。或者是你的帐号有问题,Connection reset by peer 表示连接被对方服务器关闭了。

cinvro commented 3 years ago

这个应该是你本地网络的问题。或者是你的帐号有问题,Connection reset by peer 表示连接被对方服务器关闭了。

我用公司的VPN试了下,又可以了。但是换到家里的网络就不行。不太像是账户的问题,但是我手边也没有别的号可以测试。

估计是PCS改了什么规则,今天不止我一个人遇到了类似的问题:https://github.com/qjfoidnh/BaiduPCS-Go/issues/93

yzf123456 commented 3 years ago

你好,我安装之后,版本最新是0.5.7,方便的话能说你下你是怎么安装的吗?或者你知道是什么原因吗?

PeterDing commented 3 years ago

试试用 https://github.com/qjfoidnh/BaiduPCS-Go/issues/93 提到的方法。