Create your Own KiteConnect Dashboard with the help of Flask Framework.

Flask is a micro web framework written in python to achieve this type of framework you can proceed with the the help of this code and can achiveve just need to follow the exact steps in videos.


After above videos if you missed something this is the way it should be processed which you can follow from the image

For Logging the web page and getting access token look like this

import json
from flask import Flask, request
from kiteconnect import KiteConnect

# Base settings
PORT = 5010
HOST = "127.0.0.1"

# Kite Connect App settings. Go to https://developers.kite.trade/apps/
# to create an app if you don't have one.
kite_api_key = "your_api_key"
kite_api_secret = "your_access_token"

# Create a redirect url
redirect_url = "http://{host}:{port}/login".format(host=HOST, port=PORT)

# Login url
login_url = "https://api.kite.trade/connect/login?api_key={api_key}".format(
    api_key=kite_api_key)

# Kite connect console url
console_url = "https://developers.kite.trade/apps/{api_key}".format(
    api_key=kite_api_key)

# App
app = Flask(__name__)


index_template = """
    
Make sure your app with api_key - {api_key} has set redirect to {redirect_url}.
login_template = """ <h2 style="color: green;"> Success</h2> <div> Access token: <b>{access_token}</b></div> <h4> User login data</h4> <pre>{user_data}</pre> <a href="https://www.blogger.com/%7Bholdings_url%7D" target="_blank"><h4> Fetch user holdings</h4> </a> <a href="https://www.blogger.com/%7Borders_url%7D" target="_blank"><h4> Fetch user orders</h4> </a> <a href="https://kite.trade/docs/connect/v1/" target="_blank"><h4> Checks Kite Connect docs for other calls.</h4> </a>""" @app.route("/") def index(): return index_template.format(api_key=kite_api_key, redirect_url=redirect_url, console_url=console_url, login_url=login_url) @app.route("/login") def login(): request_token = request.args.get("request_token") if not request_token: return """ <span style="color: red;">Error while generating request token.</span><a href="https://www.blogger.com/"> Try again.</a><a href="https://www.blogger.com/null">""" kite = KiteConnect(api_key=kite_api_key) data = kite.request_access_token(request_token, secret=kite_api_secret) holdings_url = ("https://api.kite.trade/portfolio/holdings" "?api_key={api_key}&access_token={access_token}").format( api_key=kite_api_key, access_token=data["access_token"]) orders_url = ("https://api.kite.trade/orders" "?api_key={api_key}&access_token={access_token}").format( api_key=kite_api_key, access_token=data["access_token"]) return login_template.format(access_token=data["access_token"], user_data=json.dumps(data, indent=4, sort_keys=True), holdings_url=holdings_url, orders_url=orders_url) if __name__ == "__main__": print("Starting server: http://{host}:{port}".format(host=HOST, port=PORT)) app.run(host=HOST, port=PORT, debug=True)
View Code in GitHub Follow Below: