unable to get request_token from url parameters

desiredoom
hi, ive written this code, please tell me where i am going wrong, im a beginner in python so i can use all the help that i can get for this, what im trying to do is to use bottle to start a standalone server to get the request token so can then post it and login.

# CODE STARTS HERE

from kiteconnect import KiteConnect
from bottle import run , request , route
import webbrowser

api_key="xxxx"
api_secret = "xxxx"
kite = KiteConnect(api_key=api_key)
url = kite.login_url()
webbrowser.open(url)

@route('/')

def root():
tk_request = request.query.token_request
return 'the token request is' + tk_request

run(Debug=True,reloader=True)

user = kite.request_access_token(request_token=tk_request,secret=api_secret)
print(user["user_id"], "has logged in")

# END OF CODE
  • sujith
    Hi,
    We don't recommend automating login as it is mandatory by exchange to login manually once a day.
This discussion has been closed.