Connection errors on fetching NSE 200 stocks 1 day data

cisk
cisk edited January 2018 in Market data (WebSockets)
Hi Team,

I am getting below mentioned errors when I try to fetch 1 day data for each of NSE 200 stocks. After querying for each stock, I pause for 0.5sec and then fire my query for the next stock. This happens repeatedly after fetching data for appx 30stocks and 1-day worth data. I am using Kite 3 version. Please help!

Traceback (most recent call last):
File "/Users/cisk/anaconda3/lib/python3.6/site-packages/requests/packages/urllib3/contrib/pyopenssl.py", line 438, in wrap_socket
cnx.do_handshake()
File "/Users/cisk/anaconda3/lib/python3.6/site-packages/OpenSSL/SSL.py", line 1806, in do_handshake
self._raise_ssl_error(self._ssl, result)
File "/Users/cisk/anaconda3/lib/python3.6/site-packages/OpenSSL/SSL.py", line 1539, 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 "/Users/cisk/anaconda3/lib/python3.6/site-packages/requests/packages/urllib3/connectionpool.py", line 600, in urlopen
chunked=chunked)
File "/Users/cisk/anaconda3/lib/python3.6/site-packages/requests/packages/urllib3/connectionpool.py", line 345, in _make_request
self._validate_conn(conn)
File "/Users/cisk/anaconda3/lib/python3.6/site-packages/requests/packages/urllib3/connectionpool.py", line 844, in _validate_conn
conn.connect()
File "/Users/cisk/anaconda3/lib/python3.6/site-packages/requests/packages/urllib3/connection.py", line 326, in connect
ssl_context=context)
File "/Users/cisk/anaconda3/lib/python3.6/site-packages/requests/packages/urllib3/util/ssl_.py", line 325, in ssl_wrap_socket
return context.wrap_socket(sock, server_hostname=server_hostname)
File "/Users/cisk/anaconda3/lib/python3.6/site-packages/requests/packages/urllib3/contrib/pyopenssl.py", line 445, in wrap_socket
raise ssl.SSLError('bad handshake: %r' % e)
ssl.SSLError: ("bad handshake: SysCallError(-1, 'Unexpected EOF')",)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/Users/cisk/anaconda3/lib/python3.6/site-packages/requests/adapters.py", line 438, in send
timeout=timeout
File "/Users/cisk/anaconda3/lib/python3.6/site-packages/requests/packages/urllib3/connectionpool.py", line 630, in urlopen
raise SSLError(e)
requests.packages.urllib3.exceptions.SSLError: ("bad handshake: SysCallError(-1, 'Unexpected EOF')",)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/Users/cisk/PycharmProjects/pykiteconnect/HistoricalData.py", line 48, in
histData.fetchData()
File "/Users/cisk/PycharmProjects/pykiteconnect/HistoricalData.py", line 32, in fetchData
CONSTANTS.API_KEY + "&access_token=" + self.accessToken)
File "/Users/cisk/anaconda3/lib/python3.6/site-packages/requests/api.py", line 72, in get
return request('get', url, params=params, **kwargs)
File "/Users/cisk/anaconda3/lib/python3.6/site-packages/requests/api.py", line 58, in request
return session.request(method=method, url=url, **kwargs)
File "/Users/cisk/anaconda3/lib/python3.6/site-packages/requests/sessions.py", line 518, in request
resp = self.send(prep, **send_kwargs)
File "/Users/cisk/anaconda3/lib/python3.6/site-packages/requests/sessions.py", line 639, in send
r = adapter.send(request, **kwargs)
File "/Users/cisk/anaconda3/lib/python3.6/site-packages/requests/adapters.py", line 512, in send
raise SSLError(e, request=request)
requests.exceptions.SSLError: ("bad handshake: SysCallError(-1, 'Unexpected EOF')",)

Process finished with exit code 1
  • Vivek
    This seems like a network issue and we haven't came across this. Can you please check on different network?
  • cisk
    Ok I'll check and let you know
  • cisk
    @vivek Yes it was some network issue I guess. On multiple tries, I was able to download the data without any issue. Thanks
This discussion has been closed.