Closed amelksibi2019 closed 4 years ago
@amelksibi2019 Hey were you able to get past this error?
@amelksibi2019 Hey, I am getting a similar error after running : twitterscraper Trump --limit 100 --output=tweets.json Could you please help me get past it? error: INFO: {'User-Agent': 'Mozilla/5.0 (Windows; U; Windows NT 6.1; x64; fr; rv:1.9.2.13) Gecko/20101203 Firebird/3.6.13'} Traceback (most recent call last): File "/home/shradha/anaconda3/lib/python3.6/site-packages/urllib3/contrib/pyopenssl.py", line 441, in wrap_socket cnx.do_handshake() File "/home/shradha/anaconda3/lib/python3.6/site-packages/OpenSSL/SSL.py", line 1716, in do_handshake self._raise_ssl_error(self._ssl, result) File "/home/shradha/anaconda3/lib/python3.6/site-packages/OpenSSL/SSL.py", line 1448, in _raise_ssl_error raise SysCallError(errno, errorcode.get(errno)) OpenSSL.SSL.SysCallError: (104, 'ECONNRESET')
During handling of the above exception, another exception occurred:
Traceback (most recent call last): File "/home/shradha/anaconda3/lib/python3.6/site-packages/urllib3/connectionpool.py", line 601, in urlopen chunked=chunked) File "/home/shradha/anaconda3/lib/python3.6/site-packages/urllib3/connectionpool.py", line 346, in _make_request self._validate_conn(conn) File "/home/shradha/anaconda3/lib/python3.6/site-packages/urllib3/connectionpool.py", line 850, in _validate_conn conn.connect() File "/home/shradha/anaconda3/lib/python3.6/site-packages/urllib3/connection.py", line 326, in connect sslcontext=context) File "/home/shradha/anaconda3/lib/python3.6/site-packages/urllib3/util/ssl.py", line 329, in ssl_wrap_socket return context.wrap_socket(sock, server_hostname=server_hostname) File "/home/shradha/anaconda3/lib/python3.6/site-packages/urllib3/contrib/pyopenssl.py", line 448, in wrap_socket raise ssl.SSLError('bad handshake: %r' % e) ssl.SSLError: ("bad handshake: SysCallError(104, 'ECONNRESET')",)
During handling of the above exception, another exception occurred:
Traceback (most recent call last): File "/home/shradha/anaconda3/lib/python3.6/site-packages/requests/adapters.py", line 440, in send timeout=timeout File "/home/shradha/anaconda3/lib/python3.6/site-packages/urllib3/connectionpool.py", line 639, in urlopen _stacktrace=sys.exc_info()[2]) File "/home/shradha/anaconda3/lib/python3.6/site-packages/urllib3/util/retry.py", line 388, in increment raise MaxRetryError(_pool, url, error or ResponseError(cause)) urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='free-proxy-list.net', port=443): Max retries exceeded with url: / (Caused by SSLError(SSLError("bad handshake: SysCallError(104, 'ECONNRESET')",),))
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/shradha/anaconda3/bin/twitterscraper", line 11, in
What OS are you running it on? We're experiencing similar issues on macOS.
Got the same error on OSX
Interesting... My team ran twitterscraper just fine on Windows 10 and Ubuntu 18.04 LTS. Looks like this issue is exclusive to macOS?
no it is not exclusive to macOS, I'm running on windows 10 and it is giving me the same error. and this happens only for this statement
from twitterscraper.query import query_user_info
I just gave up
@youssefsaqr @mysterefrank @amelksibi2019 are you still experiencing this issue?
I cannot reproduce you try this solution? https://github.com/psf/requests/issues/4246#issuecomment-323398451
Please ping me or start a new issue if you have further questions
I think this is related - I can't get from twitterscraper import query_tweets
to work. I get this error message and it has something to do with a bad handshake with SSL. I've tried updating the python version and reinstalling twitterscraper but it doesn't work. I'm on macOS Catalina Version 10.15.5
INFO: {'User-Agent': 'Mozilla/5.0 (compatible, MSIE 11, Windows NT 6.3; Trident/7.0; rv:11.0) like Gecko'}
Traceback (most recent call last):
File "/Users/glencote/.pyenv/versions/3.8.3/lib/python3.8/site-packages/urllib3/connectionpool.py", line 670, in urlopen
httplib_response = self._make_request(
File "/Users/glencote/.pyenv/versions/3.8.3/lib/python3.8/site-packages/urllib3/connectionpool.py", line 381, in _make_request
self._validate_conn(conn)
File "/Users/glencote/.pyenv/versions/3.8.3/lib/python3.8/site-packages/urllib3/connectionpool.py", line 976, in _validate_conn
conn.connect()
File "/Users/glencote/.pyenv/versions/3.8.3/lib/python3.8/site-packages/urllib3/connection.py", line 361, in connect
self.sock = ssl_wrap_socket(
File "/Users/glencote/.pyenv/versions/3.8.3/lib/python3.8/site-packages/urllib3/util/ssl_.py", line 377, in ssl_wrap_socket
return context.wrap_socket(sock, server_hostname=server_hostname)
File "/Users/glencote/.pyenv/versions/3.8.3/lib/python3.8/ssl.py", line 500, in wrap_socket
return self.sslsocket_class._create(
File "/Users/glencote/.pyenv/versions/3.8.3/lib/python3.8/ssl.py", line 1040, in _create
self.do_handshake()
File "/Users/glencote/.pyenv/versions/3.8.3/lib/python3.8/ssl.py", line 1309, in do_handshake
self._sslobj.do_handshake()
ssl.SSLError: [SSL: WRONG_VERSION_NUMBER] wrong version number (_ssl.c:1108)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/Users/glencote/.pyenv/versions/3.8.3/lib/python3.8/site-packages/requests/adapters.py", line 439, in send
resp = conn.urlopen(
File "/Users/glencote/.pyenv/versions/3.8.3/lib/python3.8/site-packages/urllib3/connectionpool.py", line 724, in urlopen
retries = retries.increment(
File "/Users/glencote/.pyenv/versions/3.8.3/lib/python3.8/site-packages/urllib3/util/retry.py", line 439, in increment
raise MaxRetryError(_pool, url, error or ResponseError(cause))
urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='free-proxy-list.net', port=443): Max retries exceeded with url: / (Caused by SSLError(SSLError(1, '[SSL: WRONG_VERSION_NUMBER] wrong version number (_ssl.c:1108)')))
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "please_work.py", line 1, in <module>
from twitterscraper import query_tweets
File "/Users/glencote/.pyenv/versions/3.8.3/lib/python3.8/site-packages/twitterscraper/__init__.py", line 13, in <module>
from twitterscraper.query import query_tweets
File "/Users/glencote/.pyenv/versions/3.8.3/lib/python3.8/site-packages/twitterscraper/query.py", line 73, in <module>
proxies = get_proxies()
File "/Users/glencote/.pyenv/versions/3.8.3/lib/python3.8/site-packages/twitterscraper/query.py", line 43, in get_proxies
response = requests.get(PROXY_URL)
File "/Users/glencote/.pyenv/versions/3.8.3/lib/python3.8/site-packages/requests/api.py", line 76, in get
return request('get', url, params=params, **kwargs)
File "/Users/glencote/.pyenv/versions/3.8.3/lib/python3.8/site-packages/requests/api.py", line 61, in request
return session.request(method=method, url=url, **kwargs)
File "/Users/glencote/.pyenv/versions/3.8.3/lib/python3.8/site-packages/requests/sessions.py", line 530, in request
resp = self.send(prep, **send_kwargs)
File "/Users/glencote/.pyenv/versions/3.8.3/lib/python3.8/site-packages/requests/sessions.py", line 643, in send
r = adapter.send(request, **kwargs)
File "/Users/glencote/.pyenv/versions/3.8.3/lib/python3.8/site-packages/requests/adapters.py", line 514, in send
raise SSLError(e, request=request)
requests.exceptions.SSLError: HTTPSConnectionPool(host='free-proxy-list.net', port=443): Max retries exceeded with url: / (Caused by SSLError(SSLError(1, '[SSL: WRONG_VERSION_NUMBER] wrong version number (_ssl.c:1108)')))
Even though this issue is closed, I just witnessed this error. I am using MacOS.
Just experienced the error using Ubuntu 20.04 by simply doing
import twitterscraper
---------------------------------------------------------------------------
SSLError Traceback (most recent call last)
/usr/lib/python3/dist-packages/urllib3/connectionpool.py in urlopen(self, method, url, body, headers, retries, redirect, assert_same_host, timeout, pool_timeout, release_conn, chunked, body_pos, **response_kw)
664 # Make the request on the httplib connection object.
--> 665 httplib_response = self._make_request(
666 conn,
/usr/lib/python3/dist-packages/urllib3/connectionpool.py in _make_request(self, conn, method, url, timeout, chunked, **httplib_request_kw)
375 try:
--> 376 self._validate_conn(conn)
377 except (SocketTimeout, BaseSSLError) as e:
/usr/lib/python3/dist-packages/urllib3/connectionpool.py in _validate_conn(self, conn)
995 if not getattr(conn, "sock", None): # AppEngine might not have `.sock`
--> 996 conn.connect()
997
/usr/lib/python3/dist-packages/urllib3/connection.py in connect(self)
351
--> 352 self.sock = ssl_wrap_socket(
353 sock=conn,
/usr/lib/python3/dist-packages/urllib3/util/ssl_.py in ssl_wrap_socket(sock, keyfile, certfile, cert_reqs, ca_certs, server_hostname, ssl_version, ciphers, ssl_context, ca_cert_dir, key_password)
369 if HAS_SNI and server_hostname is not None:
--> 370 return context.wrap_socket(sock, server_hostname=server_hostname)
371
/usr/lib/python3.8/ssl.py in wrap_socket(self, sock, server_side, do_handshake_on_connect, suppress_ragged_eofs, server_hostname, session)
499 # ctx._wrap_socket()
--> 500 return self.sslsocket_class._create(
501 sock=sock,
/usr/lib/python3.8/ssl.py in _create(cls, sock, server_side, do_handshake_on_connect, suppress_ragged_eofs, server_hostname, context, session)
1039 raise ValueError("do_handshake_on_connect should not be specified for non-blocking sockets")
-> 1040 self.do_handshake()
1041 except (OSError, ValueError):
/usr/lib/python3.8/ssl.py in do_handshake(self, block)
1308 self.settimeout(None)
-> 1309 self._sslobj.do_handshake()
1310 finally:
SSLError: [SSL: WRONG_VERSION_NUMBER] wrong version number (_ssl.c:1108)
During handling of the above exception, another exception occurred:
MaxRetryError Traceback (most recent call last)
/usr/lib/python3/dist-packages/requests/adapters.py in send(self, request, stream, timeout, verify, cert, proxies)
438 if not chunked:
--> 439 resp = conn.urlopen(
440 method=request.method,
/usr/lib/python3/dist-packages/urllib3/connectionpool.py in urlopen(self, method, url, body, headers, retries, redirect, assert_same_host, timeout, pool_timeout, release_conn, chunked, body_pos, **response_kw)
718
--> 719 retries = retries.increment(
720 method, url, error=e, _pool=self, _stacktrace=sys.exc_info()[2]
/usr/lib/python3/dist-packages/urllib3/util/retry.py in increment(self, method, url, response, error, _pool, _stacktrace)
435 if new_retry.is_exhausted():
--> 436 raise MaxRetryError(_pool, url, error or ResponseError(cause))
437
MaxRetryError: HTTPSConnectionPool(host='free-proxy-list.net', port=443): Max retries exceeded with url: / (Caused by SSLError(SSLError(1, '[SSL: WRONG_VERSION_NUMBER] wrong version number (_ssl.c:1108)')))
During handling of the above exception, another exception occurred:
SSLError Traceback (most recent call last)
<ipython-input-4-6de3c36938a1> in <module>
----> 1 import twitterscraper
/usr/local/lib/python3.8/dist-packages/twitterscraper/__init__.py in <module>
11
12
---> 13 from twitterscraper.query import query_tweets
14 from twitterscraper.query import query_tweets_from_user
15 from twitterscraper.query import query_user_info
/usr/local/lib/python3.8/dist-packages/twitterscraper/query.py in <module>
74 yield start + h * i
75
---> 76 proxies = get_proxies()
77 proxy_pool = cycle(proxies)
78
/usr/local/lib/python3.8/dist-packages/twitterscraper/query.py in get_proxies()
44
45 def get_proxies():
---> 46 response = requests.get(PROXY_URL)
47 soup = BeautifulSoup(response.text, 'lxml')
48 table = soup.find('table',id='proxylisttable')
/usr/lib/python3/dist-packages/requests/api.py in get(url, params, **kwargs)
73
74 kwargs.setdefault('allow_redirects', True)
---> 75 return request('get', url, params=params, **kwargs)
76
77
/usr/lib/python3/dist-packages/requests/api.py in request(method, url, **kwargs)
58 # cases, and look like a memory leak in others.
59 with sessions.Session() as session:
---> 60 return session.request(method=method, url=url, **kwargs)
61
62
/usr/lib/python3/dist-packages/requests/sessions.py in request(self, method, url, params, data, headers, cookies, files, auth, timeout, allow_redirects, proxies, hooks, stream, verify, cert, json)
531 }
532 send_kwargs.update(settings)
--> 533 resp = self.send(prep, **send_kwargs)
534
535 return resp
/usr/lib/python3/dist-packages/requests/sessions.py in send(self, request, **kwargs)
644
645 # Send the request
--> 646 r = adapter.send(request, **kwargs)
647
648 # Total elapsed time of the request (approximately)
/usr/lib/python3/dist-packages/requests/adapters.py in send(self, request, stream, timeout, verify, cert, proxies)
512 if isinstance(e.reason, _SSLError):
513 # This branch is for urllib3 v1.22 and later.
--> 514 raise SSLError(e, request=request)
515
516 raise ConnectionError(e, request=request)
SSLError: HTTPSConnectionPool(host='free-proxy-list.net', port=443): Max retries exceeded with url: / (Caused by SSLError(SSLError(1, '[SSL: WRONG_VERSION_NUMBER] wrong version number (_ssl.c:1108)')))
@youssefsaqr @mysterefrank @amelksibi2019 are you still experiencing this issue?
I cannot reproduce you try this solution? psf/requests#4246 (comment)
Please ping me or start a new issue if you have further questions
This solution does not work on WSL2 Ubuntu at the very least, same problem as everyone else
when I tried this statement,
INFO: {'User-Agent': 'Mozilla/5.0 (Windows; U; Windows NT 6.1; rv:2.2) Gecko/20110201'} Traceback (most recent call last): File "c:\users\amel\anaconda3\lib\site-packages\urllib3\contrib\pyopenssl.py", line 453, in wrap_socket cnx.do_handshake() File "c:\users\amel\anaconda3\lib\site-packages\OpenSSL\SSL.py", line 1915, in do_handshake self._raise_ssl_error(self._ssl, result) File "c:\users\amel\anaconda3\lib\site-packages\OpenSSL\SSL.py", line 1639, in _raise_ssl_error raise SysCallError(errno, errorcode.get(errno)) OpenSSL.SSL.SysCallError: (10054, 'WSAECONNRESET')
During handling of the above exception, another exception occurred:
Traceback (most recent call last): File "c:\users\amel\anaconda3\lib\site-packages\urllib3\connectionpool.py", line 600, in urlopen chunked=chunked) File "c:\users\amel\anaconda3\lib\site-packages\urllib3\connectionpool.py", line 343, in _make_request self._validate_conn(conn) File "c:\users\amel\anaconda3\lib\site-packages\urllib3\connectionpool.py", line 839, in _validate_conn conn.connect() File "c:\users\amel\anaconda3\lib\site-packages\urllib3\connection.py", line 344, in connect sslcontext=context) File "c:\users\amel\anaconda3\lib\site-packages\urllib3\util\ssl.py", line 344, in ssl_wrap_socket return context.wrap_socket(sock, server_hostname=server_hostname) File "c:\users\amel\anaconda3\lib\site-packages\urllib3\contrib\pyopenssl.py", line 459, in wrap_socket raise ssl.SSLError('bad handshake: %r' % e) ssl.SSLError: ("bad handshake: SysCallError(10054, 'WSAECONNRESET')",)
During handling of the above exception, another exception occurred:
Traceback (most recent call last): File "c:\users\amel\anaconda3\lib\site-packages\requests\adapters.py", line 449, in send timeout=timeout File "c:\users\amel\anaconda3\lib\site-packages\urllib3\connectionpool.py", line 638, in urlopen _stacktrace=sys.exc_info()[2]) File "c:\users\amel\anaconda3\lib\site-packages\urllib3\util\retry.py", line 398, in increment raise MaxRetryError(_pool, url, error or ResponseError(cause)) urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='free-proxy-list.net', port=443): Max retries exceeded with url: / (Caused by SSLError(SSLError("bad handshake: SysCallError(10054, 'WSAECONNRESET')")))
During handling of the above exception, another exception occurred:
Traceback (most recent call last): File "c:\users\amel\anaconda3\lib\runpy.py", line 193, in _run_module_as_main "main", mod_spec) File "c:\users\amel\anaconda3\lib\runpy.py", line 85, in _run_code exec(code, run_globals) File "C:\Users\Amel\Anaconda3\Scripts\twitterscraper.exe__main.py", line 5, in
File "c:\users\amel\anaconda3\lib\site-packages\twitterscraper\ init__.py", line 13, in
from twitterscraper.query import query_tweets
File "c:\users\amel\anaconda3\lib\site-packages\twitterscraper\query.py", line 73, in
proxies = get_proxies()
File "c:\users\amel\anaconda3\lib\site-packages\twitterscraper\query.py", line 43, in get_proxies
response = requests.get(PROXY_URL)
File "c:\users\amel\anaconda3\lib\site-packages\requests\api.py", line 75, in get
return request('get', url, params=params, kwargs)
File "c:\users\amel\anaconda3\lib\site-packages\requests\api.py", line 60, in request
return session.request(method=method, url=url, kwargs)
File "c:\users\amel\anaconda3\lib\site-packages\requests\sessions.py", line 533, in request
resp = self.send(prep, send_kwargs)
File "c:\users\amel\anaconda3\lib\site-packages\requests\sessions.py", line 646, in send
r = adapter.send(request, kwargs)
File "c:\users\amel\anaconda3\lib\site-packages\requests\adapters.py", line 514, in send
raise SSLError(e, request=request)
requests.exceptions.SSLError: HTTPSConnectionPool(host='free-proxy-list.net', port=443): Max retries exceeded with url: / (Caused by SSLError(SSLError("bad handshake: SysCallError(10054, 'WSAECONNRESET')")))
C:>