twitter-python-ads-sdk
twitter-python-ads-sdk copied to clipboard
Handshake error with urllib
Here is my code:
for account, queued_jobs in self.accounts_to_queued_jobs.items():
for queued_job in queued_jobs:
async_stats_job_result = self.entity_type.async_stats_job_result(account,
queued_job.id)
status = next(async_stats_job_result).status
while status == 'PROCESSING':
async_stats_job_result = self.entity_type.async_stats_job_result(account,
queued_job.id)
status = next(async_stats_job_result).status
time.sleep(5)
I am getting the following error:
Traceback (most recent call last):
File "/home/ubuntu/.local/lib/python3.6/site-packages/urllib3/contrib/pyopenssl.py", line 485, in wrap_socket
cnx.do_handshake()
File "/usr/lib/python3/dist-packages/OpenSSL/SSL.py", line 1808, in do_handshake
self._raise_ssl_error(self._ssl, result)
File "/usr/lib/python3/dist-packages/OpenSSL/SSL.py", line 1541, in _raise_ssl_error
raise SysCallError(-1, "Unexpected EOF")
OpenSSL.SSL.SysCallError: (-1, 'Unexpected EOF')
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/ubuntu/.local/lib/python3.6/site-packages/urllib3/connectionpool.py", line 672, in urlopen
chunked=chunked,
File "/home/ubuntu/.local/lib/python3.6/site-packages/urllib3/connectionpool.py", line 376, in _make_request
self._validate_conn(conn)
File "/home/ubuntu/.local/lib/python3.6/site-packages/urllib3/connectionpool.py", line 994, in _validate_conn
conn.connect()
File "/home/ubuntu/.local/lib/python3.6/site-packages/urllib3/connection.py", line 394, in connect
ssl_context=context,
File "/home/ubuntu/.local/lib/python3.6/site-packages/urllib3/util/ssl_.py", line 370, in ssl_wrap_socket
return context.wrap_socket(sock, server_hostname=server_hostname)
File "/home/ubuntu/.local/lib/python3.6/site-packages/urllib3/contrib/pyopenssl.py", line 491, in wrap_socket
raise ssl.SSLError("bad handshake: %r" % e)
ssl.SSLError: ("bad handshake: SysCallError(-1, 'Unexpected EOF')",)
The stacktrace doesnt point to an error within my code but points to urllib3. Is this an issue with twitter-python-ads-sdk integrating with urllib3? I was not able to reproduce the issue
I was able to reproduce it, but it is inconsistent. Every few times I run the program I get the error in the same place. Even though the stacktrace doesnt provide anything the reason I know its failing within the code sample is because of logging
Hi, I am having a same issue. Any suggestion on how to resolve it?