Remote end closed connection without response

apind81
Anyway I can handle the below error?
---------------------------------------------------------------------------
RemoteDisconnected Traceback (most recent call last)
C:\Program Files (x86)\Anaconda3\lib\site-packages\requests\packages\urllib3\connectionpool.py in urlopen(self, method, url, body, headers, retries, redirect, assert_same_host, timeout, pool_timeout, release_conn, chunked, **response_kw)
594 body=body, headers=headers,
--> 595 chunked=chunked)
596

C:\Program Files (x86)\Anaconda3\lib\site-packages\requests\packages\urllib3\connectionpool.py in _make_request(self, conn, method, url, timeout, chunked, **httplib_request_kw)
392 # otherwise it looks like a programming error was the cause.
--> 393 six.raise_from(e, None)
394 except (SocketTimeout, BaseSSLError, SocketError) as e:

C:\Program Files (x86)\Anaconda3\lib\site-packages\requests\packages\urllib3\packages\six.py in raise_from(value, from_value)

C:\Program Files (x86)\Anaconda3\lib\site-packages\requests\packages\urllib3\connectionpool.py in _make_request(self, conn, method, url, timeout, chunked, **httplib_request_kw)
388 try:
--> 389 httplib_response = conn.getresponse()
390 except Exception as e:

C:\Program Files (x86)\Anaconda3\lib\http\client.py in getresponse(self)
1196 try:
-> 1197 response.begin()
1198 except ConnectionError:

C:\Program Files (x86)\Anaconda3\lib\http\client.py in begin(self)
296 while True:
--> 297 version, status, reason = self._read_status()
298 if status != CONTINUE:

C:\Program Files (x86)\Anaconda3\lib\http\client.py in _read_status(self)
265 # sending a valid response.
--> 266 raise RemoteDisconnected("Remote end closed connection without"
267 " response")

RemoteDisconnected: Remote end closed connection without response
  • sujith
    Hi @apind81,
    I am not sure if request reached the server or not.
    If this is happening today, can you let us know the time and private message your api_key?
  • mkrathi
    I also get this..

    ERROR:root:Exception occurred in BankNiftySpot function at 2023-06-06 15:55:37
    Traceback (most recent call last):
    File "C:\DDrive\Python\lib\site-packages\urllib3\connectionpool.py", line 449, in _make_request
    six.raise_from(e, None)
    File "", line 3, in raise_from
    File "C:\DDrive\Python\lib\site-packages\urllib3\connectionpool.py", line 444, in _make_request
    httplib_response = conn.getresponse()
    File "C:\DDrive\Python\lib\http\client.py", line 1374, in getresponse
    response.begin()
    File "C:\DDrive\Python\lib\http\client.py", line 318, in begin
    version, status, reason = self._read_status()
    File "C:\DDrive\Python\lib\http\client.py", line 279, in _read_status
    line = str(self.fp.readline(_MAXLINE + 1), "iso-8859-1")
    File "C:\DDrive\Python\lib\socket.py", line 705, in readinto
    return self._sock.recv_into(b)
    File "C:\DDrive\Python\lib\ssl.py", line 1274, in recv_into
    return self.read(nbytes, buffer)
    File "C:\DDrive\Python\lib\ssl.py", line 1130, in read
    return self._sslobj.read(len, buffer)
    TimeoutError: The read operation timed out

    During handling of the above exception, another exception occurred:

    Traceback (most recent call last):
    File "C:\DDrive\Python\lib\site-packages\requests\adapters.py", line 489, in send
    resp = conn.urlopen(
    File "C:\DDrive\Python\lib\site-packages\urllib3\connectionpool.py", line 787, in urlopen
    retries = retries.increment(
    File "C:\DDrive\Python\lib\site-packages\urllib3\util\retry.py", line 550, in increment
    raise six.reraise(type(error), error, _stacktrace)
    File "C:\DDrive\Python\lib\site-packages\urllib3\packages\six.py", line 770, in reraise
    raise value
    File "C:\DDrive\Python\lib\site-packages\urllib3\connectionpool.py", line 703, in urlopen
    httplib_response = self._make_request(
    File "C:\DDrive\Python\lib\site-packages\urllib3\connectionpool.py", line 451, in _make_request
    self._raise_timeout(err=e, url=url, timeout_value=read_timeout)
    File "C:\DDrive\Python\lib\site-packages\urllib3\connectionpool.py", line 340, 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 "c:\DDrive\OneDrive\StockTrading\Algo\MyAlgoFunctions.py", line 751, in BankNiftySpot
    quote = kite.quote([260105])
    File "C:\DDrive\Python\lib\site-packages\kiteconnect\connect.py", line 581, in quote
    data = self._get("market.quote", params={"i": ins})
    File "C:\DDrive\Python\lib\site-packages\kiteconnect\connect.py", line 851, in _get
    return self._request(route, "GET", url_args=url_args, params=params, is_json=is_json)
    File "C:\DDrive\Python\lib\site-packages\kiteconnect\connect.py", line 906, in _request
    raise e
    File "C:\DDrive\Python\lib\site-packages\kiteconnect\connect.py", line 894, in _request
    r = self.reqsession.request(method,
    File "C:\DDrive\Python\lib\site-packages\requests\sessions.py", line 587, in request
    resp = self.send(prep, **send_kwargs)
    File "C:\DDrive\Python\lib\site-packages\requests\sessions.py", line 701, in send
    r = adapter.send(request, **kwargs)
    File "C:\DDrive\Python\lib\site-packages\requests\adapters.py", line 578, in send
    raise ReadTimeout(e, request=request)
    requests.exceptions.ReadTimeout: HTTPSConnectionPool(host='api.kite.trade', port=443): Read timed out. (read timeout=7)
  • mkrathi
    @sujith pls help with above. Why I keep getting this error
  • rakeshr
    Have replied to your query here.
This discussion has been closed.