Reciving a ReadTimeout Error on my flask application

sls
sls edited March 2021 in Python client
ERROR : raise ReadTimeout(e, request=request)
requests.exceptions.ReadTimeout: HTTPSConnectionPool(host='api.kite.trade', port=443): Read timed out. (read timeout=7)


Hi I am new to python and, I am unable to understand if the above stated error was occurred because of a fault from my side or was this an api error from zerodha side, any help would be appreciated and if possible please let me know why this error occurred and how can I prevent it in future, thanks!

I am attaching my spider logs below :

[2021-03-01 10:41:33,239] ERROR in app: Exception on / [POST]
Traceback (most recent call last):
File "/Users/mani/opt/anaconda3/envs/webSocketSQL/lib/python3.8/site-packages/urllib3/connectionpool.py", line 445, in _make_request
six.raise_from(e, None)
File "", line 3, in raise_from
File "/Users/mani/opt/anaconda3/envs/webSocketSQL/lib/python3.8/site-packages/urllib3/connectionpool.py", line 440, in _make_request
httplib_response = conn.getresponse()
File "/Users/mani/opt/anaconda3/envs/webSocketSQL/lib/python3.8/http/client.py", line 1347, in getresponse
response.begin()
File "/Users/mani/opt/anaconda3/envs/webSocketSQL/lib/python3.8/http/client.py", line 307, in begin
version, status, reason = self._read_status()
File "/Users/mani/opt/anaconda3/envs/webSocketSQL/lib/python3.8/http/client.py", line 268, in _read_status
line = str(self.fp.readline(_MAXLINE + 1), "iso-8859-1")
File "/Users/mani/opt/anaconda3/envs/webSocketSQL/lib/python3.8/socket.py", line 669, in readinto
return self._sock.recv_into(b)
File "/Users/mani/opt/anaconda3/envs/webSocketSQL/lib/python3.8/ssl.py", line 1241, in recv_into
return self.read(nbytes, buffer)
File "/Users/mani/opt/anaconda3/envs/webSocketSQL/lib/python3.8/ssl.py", line 1099, in read
return self._sslobj.read(len, buffer)
socket.timeout: The read operation timed out

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/Users/mani/opt/anaconda3/envs/webSocketSQL/lib/python3.8/site-packages/requests/adapters.py", line 439, in send
resp = conn.urlopen(
File "/Users/mani/opt/anaconda3/envs/webSocketSQL/lib/python3.8/site-packages/urllib3/connectionpool.py", line 755, in urlopen
retries = retries.increment(
File "/Users/mani/opt/anaconda3/envs/webSocketSQL/lib/python3.8/site-packages/urllib3/util/retry.py", line 531, in increment
raise six.reraise(type(error), error, _stacktrace)
File "/Users/mani/opt/anaconda3/envs/webSocketSQL/lib/python3.8/site-packages/urllib3/packages/six.py", line 735, in reraise
raise value
File "/Users/mani/opt/anaconda3/envs/webSocketSQL/lib/python3.8/site-packages/urllib3/connectionpool.py", line 699, in urlopen
httplib_response = self._make_request(
File "/Users/mani/opt/anaconda3/envs/webSocketSQL/lib/python3.8/site-packages/urllib3/connectionpool.py", line 447, in _make_request
self._raise_timeout(err=e, url=url, timeout_value=read_timeout)
File "/Users/mani/opt/anaconda3/envs/webSocketSQL/lib/python3.8/site-packages/urllib3/connectionpool.py", line 336, in _raise_timeout
raise ReadTimeoutError(
urllib3.exceptions.ReadTimeoutError: HTTPSConnectionPool(host='api.kite.trade', port=443): Read timed out. (read timeout=7)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/Users/mani/opt/anaconda3/envs/webSocketSQL/lib/python3.8/site-packages/flask/app.py", line 2447, in wsgi_app
response = self.full_dispatch_request()
File "/Users/mani/opt/anaconda3/envs/webSocketSQL/lib/python3.8/site-packages/flask/app.py", line 1952, in full_dispatch_request
rv = self.handle_user_exception(e)
File "/Users/mani/opt/anaconda3/envs/webSocketSQL/lib/python3.8/site-packages/flask/app.py", line 1821, in handle_user_exception
reraise(exc_type, exc_value, tb)
File "/Users/mani/opt/anaconda3/envs/webSocketSQL/lib/python3.8/site-packages/flask/_compat.py", line 39, in reraise
raise value
File "/Users/mani/opt/anaconda3/envs/webSocketSQL/lib/python3.8/site-packages/flask/app.py", line 1950, in full_dispatch_request
rv = self.dispatch_request()
File "/Users/mani/opt/anaconda3/envs/webSocketSQL/lib/python3.8/site-packages/flask/app.py", line 1936, in dispatch_request
return self.view_functions[rule.endpoint](**req.view_args)
File "/Users/mani/Downloads/final_app/app.py", line 151, in webhook
ohlc = fetchOHLC(stock_name,"minute",3)
File "/Users/mani/Downloads/final_app/app.py", line 99, in fetchOHLC
data = pd.DataFrame(kite.historical_data(instrument,dt.date.today()-dt.timedelta(duration), dt.date.today(),interval))
File "/Users/mani/opt/anaconda3/envs/webSocketSQL/lib/python3.8/site-packages/kiteconnect/connect.py", line 624, in historical_data
data = self._get("market.historical",
File "/Users/mani/opt/anaconda3/envs/webSocketSQL/lib/python3.8/site-packages/kiteconnect/connect.py", line 826, in _get
return self._request(route, "GET", url_args=url_args, params=params, is_json=is_json)
File "/Users/mani/opt/anaconda3/envs/webSocketSQL/lib/python3.8/site-packages/kiteconnect/connect.py", line 877, in _request
raise e
File "/Users/mani/opt/anaconda3/envs/webSocketSQL/lib/python3.8/site-packages/kiteconnect/connect.py", line 865, in _request
r = self.reqsession.request(method,
File "/Users/mani/opt/anaconda3/envs/webSocketSQL/lib/python3.8/site-packages/requests/api.py", line 61, in request
return session.request(method=method, url=url, **kwargs)
File "/Users/mani/opt/anaconda3/envs/webSocketSQL/lib/python3.8/site-packages/requests/sessions.py", line 542, in request
resp = self.send(prep, **send_kwargs)
File "/Users/mani/opt/anaconda3/envs/webSocketSQL/lib/python3.8/site-packages/requests/sessions.py", line 655, in send
r = adapter.send(request, **kwargs)
File "/Users/mani/opt/anaconda3/envs/webSocketSQL/lib/python3.8/site-packages/requests/adapters.py", line 529, in send
raise ReadTimeout(e, request=request)
requests.exceptions.ReadTimeout: HTTPSConnectionPool(host='api.kite.trade', port=443): Read timed out. (read timeout=7)
Sign In or Register to comment.