zerodha / pykiteconnect

The official Python client library for the Kite Connect trading APIs
MIT License
978 stars 467 forks source link

Bug in examples/flask_app.py ..? #133

Closed vijaykz closed 2 years ago

vijaykz commented 2 years ago

In login(), get_kite_client() is invoked first, which looks for "access_token" in session. However, session["access_token"] is initiated only later. Therefore, this check in get_kite_client() is not effective.

    if "access_token" in session:
        kite.set_access_token(session["access_token"])

So, what is the purpose of set_access_token()?

vividvilla commented 2 years ago

It's just a helper method that is used in other places as well like in holdings handler. On login, as you said session is not set so it will just return the client but you can use the same method in other places where you need the client with access token set.