我有一个请求程序我正在尝试运行,但偶尔会收到此错误消息:
multiprocessing.pool.RemoteTraceback:
"""
Traceback (most recent call last):
File "C:\Users\Acer-PC\AppData\Local\Programs\Python\Python35-32\lib\site-packages\requests\packages\urllib3\connectionpool.py", line 376, in _make_request
httplib_response = conn.getresponse(buffering=True)
TypeError: getresponse() got an unexpected keyword argument 'buffering'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\Acer-PC\AppData\Local\Programs\Python\Python35-32\lib\site-packages\requests\packages\urllib3\connectionpool.py", line 559, in urlopen
body=body, headers=headers)
File "C:\Users\Acer-PC\AppData\Local\Programs\Python\Python35-32\lib\site-packages\requests\packages\urllib3\connectionpool.py", line 378, in _make_request
httplib_response = conn.getresponse()
File "C:\Users\Acer-PC\AppData\Local\Programs\Python\Python35-32\lib\http\client.py", line 1174, in getresponse
response.begin()
File "C:\Users\Acer-PC\AppData\Local\Programs\Python\Python35-32\lib\http\client.py", line 282, in begin
version, status, reason = self._read_status()
File "C:\Users\Acer-PC\AppData\Local\Programs\Python\Python35-32\lib\http\client.py", line 251, in _read_status
raise RemoteDisconnected("Remote end closed connection without"
http.client.RemoteDisconnected: Remote end closed connection without response
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\Acer-PC\AppData\Local\Programs\Python\Python35-32\lib\site-packages\requests\adapters.py", line 376, in send
timeout=timeout
File "C:\Users\Acer-PC\AppData\Local\Programs\Python\Python35-32\lib\site-packages\requests\packages\urllib3\connectionpool.py", line 609, in urlopen
_stacktrace=sys.exc_info()[2])
File "C:\Users\Acer-PC\AppData\Local\Programs\Python\Python35-32\lib\site-packages\requests\packages\urllib3\util\retry.py", line 247, in increment
raise six.reraise(type(error), error, _stacktrace)
File "C:\Users\Acer-PC\AppData\Local\Programs\Python\Python35-32\lib\site-packages\requests\packages\urllib3\packages\six.py", line 309, in reraise
raise value.with_traceback(tb)
File "C:\Users\Acer-PC\AppData\Local\Programs\Python\Python35-32\lib\site-packages\requests\packages\urllib3\connectionpool.py", line 559, in urlopen
body=body, headers=headers)
File "C:\Users\Acer-PC\AppData\Local\Programs\Python\Python35-32\lib\site-packages\requests\packages\urllib3\connectionpool.py", line 378, in _make_request
httplib_response = conn.getresponse()
File "C:\Users\Acer-PC\AppData\Local\Programs\Python\Python35-32\lib\http\client.py", line 1174, in getresponse
response.begin()
File "C:\Users\Acer-PC\AppData\Local\Programs\Python\Python35-32\lib\http\client.py", line 282, in begin
version, status, reason = self._read_status()
File "C:\Users\Acer-PC\AppData\Local\Programs\Python\Python35-32\lib\http\client.py", line 251, in _read_status
raise RemoteDisconnected("Remote end closed connection without"
requests.packages.urllib3.exceptions.ProtocolError: ('Connection aborted.', RemoteDisconnected('Remote end closed connection without response',))
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\Acer-PC\AppData\Local\Programs\Python\Python35-32\lib\multiprocessing\pool.py", line 119, in worker
result = (True, func(*args, **kwds))
File "C:\Users\Acer-PC\AppData\Local\Programs\Python\Python35-32\lib\multiprocessing\pool.py", line 47, in starmapstar
return list(itertools.starmap(args[0], args[1]))
File "C:\Users\Acer-PC\Desktop\Sineko Official Scripts\Jessie\cURL_insta_test.py", line 197, in run
if check_account(account, request):
File "C:\Users\Acer-PC\Desktop\Sineko Official Scripts\Jessie\cURL_insta_test.py", line 20, in check_account
account_url = instagram_session.get("https://instagram.com/{}".format(account))
File "C:\Users\Acer-PC\AppData\Local\Programs\Python\Python35-32\lib\site-packages\requests\sessions.py", line 480, in get
return self.request('GET', url, **kwargs)
File "C:\Users\Acer-PC\AppData\Local\Programs\Python\Python35-32\lib\site-packages\requests\sessions.py", line 468, in request
resp = self.send(prep, **send_kwargs)
File "C:\Users\Acer-PC\AppData\Local\Programs\Python\Python35-32\lib\site-packages\requests\sessions.py", line 576, in send
r = adapter.send(request, **kwargs)
File "C:\Users\Acer-PC\AppData\Local\Programs\Python\Python35-32\lib\site-packages\requests\adapters.py", line 426, in send
raise ConnectionError(err, request=request)
requests.exceptions.ConnectionError: ('Connection aborted.', RemoteDisconnected('Remote end closed connection without response',))
"""
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "C:\Users\Acer-PC\Desktop\Sineko Official Scripts\Jessie\cURL_insta_test.py", line 219, in <module>
pool.starmap(run, accounts)
File "C:\Users\Acer-PC\AppData\Local\Programs\Python\Python35-32\lib\multiprocessing\pool.py", line 268, in starmap
return self._map_async(func, iterable, starmapstar, chunksize).get()
File "C:\Users\Acer-PC\AppData\Local\Programs\Python\Python35-32\lib\multiprocessing\pool.py", line 608, in get
raise self._value
requests.exceptions.ConnectionError: ('Connection aborted.', RemoteDisconnected('Remote end closed connection without response',))
我想我明白这种情况正在发生,因为我一次发送了太多的请求,虽然它只有大约7秒钟,我想知道的是,为什么这个错误不会说什么行或什么请求发送导致错误(或者它可能,我错过了,如果是这样,请告诉我在哪里),我尝试使用尝试除了TypeError,我要么把它放在错误的地方或使用错误的错误,我应该把Try和Except放在哪里?发送请求的周围?如果是这样,我应该找一个TypeError吗?
编辑:检查了评论中列出的两个github线程,第一个说升级但我已经处于请求2.9并且他们说它对于2.7以上的任何东西而且第二个似乎没有得到一个修复的结论或者在哪里放置我自己的尝试,除了捕获错误,这是我的代码:https://github.com/Fuledbyramen/soquestion