All api call working except place_order

npchoubey
I have a code which was working all good.
But today onwards its throwing error
Invalid `api_key` or `access_token`

i am able to xecute functions like get_ltp or holding.
websocket to pull tick data is working fine as well.

raised a ticket and response was " I am afraid, check in dev forum"

any pointers please?
  • sujith
    Can you let us know more about your setup and the library you are using and version of the library you are using?
    Make sure to paste a sample code to reproduce the issue.
  • npchoubey


    I have added screen shot of code and output.
  • npchoubey
    kiteconnect==3.7.4

    Python = 3.6.7
    sys.version_info(major=3, minor=6, micro=7, releaselevel='final', serial=0)
  • npchoubey
    npchoubey edited January 2019
    from kiteconnect import KiteConnect
    api_k = "sfgshdsgh" #api_key
    api_s = "sfgsdgsagsg" #api_secret
    global kws,kite;
    kite = KiteConnect(api_key=api_k)
    print("[*] Generate access Token : ",kite.login_url())
    request_tkn = input("[*] Enter Your Request Token Here : ");
    data = kite.generate_session(request_tkn, api_secret=api_s)
    kite.set_access_token(data["access_token"])
    try:
    o1 = kite.ltp("NSE:DMART")
    print(" ltp api works ", o1)
    order_id = kite.place_order(variety="BO",tradingsymbol="INFY", validity='DAY', price=2000,\
    quantity=1,exchange="NSE",order_type="LIMIT",transaction_type="BUY",\
    product="MIS",squareoff=10, stoploss=10)
    print("Order placed. ID is ",order_id)
    except Exception as e:
    print("Order Not done: ",e)
  • rakeshr
    @npchoubey
    variety="BO"
    variety should be 'bo' not "BO".You can check all params detail here.
  • npchoubey
    Let me check. this code has been working as it as.

    More I should get error of wrong parameters not access token wrong.
  • npchoubey
    Thanks, it worked.
    But it has left my head spinning.
  • sujith
    @npchoubey,
    Please don't post your app or user-specific tokens on public threads. If you need to mention then you can use the private message feature.
This discussion has been closed.