From 2349bf3d3e84bd95b215ef1489da04abedbb554e Mon Sep 17 00:00:00 2001 From: khushal Date: Fri, 27 Dec 2024 09:53:32 +0530 Subject: [PATCH] (20241227) Payment auth fixed. --- controllers/api/payment.py | 10 +++++----- playground/socketio/to_kafka.py | 8 ++++++-- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/controllers/api/payment.py b/controllers/api/payment.py index 68c010e..0e8e1e7 100644 --- a/controllers/api/payment.py +++ b/controllers/api/payment.py @@ -140,9 +140,9 @@ class PaymentController: success = False # Get a token id: - token_key = await current_app.core_auth_token_controller.get_token_key( - db_conn = db_conn, - mongo_conn = mongo_conn, + token_key = await current_app.core_auth_token_controller.generate_token_key( + sql_conn = db_conn, + mongo_data_conn = mongo_conn, auth_token = auth_token, token_notes = {}, session_token = session_token @@ -150,8 +150,8 @@ class PaymentController: # Immediately save the details against that token id: success = await current_app.core_auth_token_controller.set_token( - db_conn = db_conn, - mongo_conn = mongo_conn, + sql_conn = db_conn, + mongo_data_conn = mongo_conn, token_key = token_key, auth_token = auth_token, token_notes = {}, diff --git a/playground/socketio/to_kafka.py b/playground/socketio/to_kafka.py index 072361a..9105283 100644 --- a/playground/socketio/to_kafka.py +++ b/playground/socketio/to_kafka.py @@ -182,6 +182,11 @@ def main(): api_key = creds["apiKey"] access_token = creds["accessToken"] + # Get the instruments of interest: + response = httpx.post(url = r"https://api.thecaoffice.com/markets/watchlist/distincts") + instruments_of_interest = response.json()["data"]["rs0"] + symbols_of_interest = [i["symbol"] for i in instruments_of_interest] + # Create an instance of Zerodha's Kite connection: kite = KiteConnect(api_key = api_key) kite.set_access_token(access_token) @@ -196,8 +201,7 @@ def main(): instruments += kite.instruments(exchange = "BCD") # Pick the instruments of interest: - instruments = instruments[:1250] - instruments = [TradingSymbol.from_zerodha_kite(i) for i in instruments] + instruments = [TradingSymbol.from_zerodha_kite(i) for i in instruments if i["tradingsymbol"] in symbols_of_interest] # Create the lookup: for i in instruments: