HTTPSConnectionPool(host='api.kite.trade', port=443): Read timed out. (read timeout=7)

shivesh1987
shivesh1987 edited November 2021 in Python client
Hi,
I am executing my python code in loop. example loop with 10000.. So starting its running fine and after sometime its giving issue as below

HTTPSConnectionPool(host='api.kite.trade', port=443): Read timed out. (read timeout=7)
  • rakeshr
    Can you let us know, which API end-point is throwing this time-out?
  • shivesh1987
    Sir I am using below code. 10 - 12 loop executing properly and after that getting this issue..


    import kiteSettings
    import time
    from kiteconnect import KiteConnect
    import logging


    def Test1(symbol):
    #time.sleep(1)

    kite = KiteConnect(kiteSettings.api_key)
    kite.set_access_token(kiteSettings.access_token)
    f1=kite.quote(symbol)
    return f1;

    # testing

    m=100


    for x in range(100000):
    m=m-1
    print(m)
    #time.sleep(1)
    symbol='NFO:AARTIIND21DECFUT','NFO:AARTIIND22JANFUT'
    f2=Test1(symbol)
    stock1="NFO:AARTIIND21DECFUT"
    bid1=(f2.get(stock1).get("depth").get("buy")[0].get("price"))
    offer1=(f2.get(stock1).get("depth").get("sell")[0].get("price"))
    stock2="NFO:AARTIIND22JANFUT"
    bid2=(f2.get(stock2).get("depth").get("buy")[0].get("price"))
    offer2=(f2.get(stock2).get("depth").get("sell")[0].get("price"))
    print(bid1)
    print(offer1)
    print(bid2)
    print(offer2)
  • sujith
    You can use the Websocket API. The Quote API is not suitable for polling.
  • shivesh1987
    shivesh1987 edited November 2021
    In quote only can I increase the default timeout and how ?
  • shivesh1987
    Also Sir if possible can you please modify above code and send to me by using Websocket API as I am little new in python.
    Please send if you can send a sample code sir, it will be very helpful to me.

    Thanks
    Shivesh
  • shivesh1987
    Sir Can you please help here. To use Websocket API, can i use in same platform. what changes required to do sir ?
  • sujith
    @shivesh1987,
    We don't provide coding support on this forum. You can take a look at the sample code here.

    This forum is dedicated only for Kite Connect related technical queries.
  • shivesh1987
    Hi sir,
    Will it work for market close also. I m executing but getting below error

    ReactorNotRestartable
  • sujith
    It does work after market. You will receive the first tick that is cached, after market.

    You can go through pykiteconnect FAQs to know more about the issue.
Sign In or Register to comment.