zerausolrac / PyCollab

Python Collab
MIT License
14 stars 6 forks source link

Connection issue #16

Open mcferenc opened 3 years ago

mcferenc commented 3 years ago

Hi there,

I´m trying to download the recordings, but I was experiencing a lot of connection issues with us.bbcollab.com. I already tried to download from two diferente networks, but the issue persists. Could someone give me a good insight to try to resolve this issue? The script downloads one or two recordings and then the connection error happen.

The error:

Traceback (most recent call last): File "C:\Python37\lib\site-packages\urllib3\connection.py", line 160, in _new_conn (self._dns_host, self.port), self.timeout, **extra_kw File "C:\Python37\lib\site-packages\urllib3\util\connection.py", line 61, in create_connection for res in socket.getaddrinfo(host, port, family, socket.SOCK_STREAM): File "C:\Python37\lib\socket.py", line 752, in getaddrinfo for res in _socket.getaddrinfo(host, port, family, type, proto, flags): socket.gaierror: [Errno 11001] getaddrinfo failed

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "C:\Python37\lib\site-packages\urllib3\connectionpool.py", line 677, in urlopen chunked=chunked, File "C:\Python37\lib\site-packages\urllib3\connectionpool.py", line 381, in _make_request self._validate_conn(conn) File "C:\Python37\lib\site-packages\urllib3\connectionpool.py", line 976, in _validate_conn conn.connect() File "C:\Python37\lib\site-packages\urllib3\connection.py", line 308, in connect conn = self._new_conn() File "C:\Python37\lib\site-packages\urllib3\connection.py", line 172, in _new_conn self, "Failed to establish a new connection: %s" % e urllib3.exceptions.NewConnectionError: <urllib3.connection.HTTPSConnection object at 0x000002CA0ED07A08>: Failed to establish a new connection: [Errno 11001] getaddrinfo failed

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "C:\Python37\lib\site-packages\requests\adapters.py", line 449, in send timeout=timeout File "C:\Python37\lib\site-packages\urllib3\connectionpool.py", line 725, in urlopen method, url, error=e, _pool=self, _stacktrace=sys.exc_info()[2] File "C:\Python37\lib\site-packages\urllib3\util\retry.py", line 439, in increment raise MaxRetryError(_pool, url, error or ResponseError(cause)) urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='us.bbcollab.com', port=443): Max retries exceeded with url: /collab/api/csa/token (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x000002CA0ED07A08>: Failed to establish a new connection: [Errno 11001] getaddrinfo failed'))

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "Collab3.py", line 49, in ut.downloadOneRecordingPUCPR(recording_id,cursoid,linha) File "C:\PyCollab2\Utilidades.py", line 215, in downloadOneRecordingPUCPR recording_data = webService.get_recording_data(recording_id) File "C:\PyCollab2\webService.py", line 95, in get_recording_data sessions = SesionControlador.SesionControlador(self.DOMAIN_C,self.getJot(),self.CERT) File "C:\PyCollab2\webService.py", line 40, in getJot self.jsesion.setJot() File "C:\PyCollab2\controladores\JotControlador.py", line 64, in setJot r = requests.post(endpoint, data=self.payload, auth=(self.key, self.secret), verify=self.cert) File "C:\Python37\lib\site-packages\requests\api.py", line 119, in post return request('post', url, data=data, json=json, kwargs) File "C:\Python37\lib\site-packages\requests\api.py", line 61, in request return session.request(method=method, url=url, kwargs) File "C:\Python37\lib\site-packages\requests\sessions.py", line 530, in request resp = self.send(prep, send_kwargs) File "C:\Python37\lib\site-packages\requests\sessions.py", line 643, in send r = adapter.send(request, kwargs) File "C:\Python37\lib\site-packages\requests\adapters.py", line 516, in send raise ConnectionError(e, request=request) requests.exceptions.ConnectionError: HTTPSConnectionPool(host='us.bbcollab.com', port=443): Max retries exceeded with url: /collab/api/csa/token (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x000002CA0ED07A08>: Failed to establish a new connection: [Errno 11001] getaddrinfo failed'))

Cesar Ferenc

mcferenc commented 3 years ago

Hi there,

The issues starts about June-07. Since that date, us.bbcollab.com has systematically disconnected my download process of recordings file. As we are doing with a batch file, it was very bad to run pycollab with this issue. The workaround I did, was to change the code of python, when the process try to establish a new connection.

I did something like that on the attach image and it´s working now.

Connection py

zerausolrac commented 3 years ago

Hi @mcferenc I will check the original code in order to replicate it, seems like is attempting to create new connection and still is another open, and check about the getaddrinfo.