(20250801) - ICICIBreeze library commented from each main.py and api/ request.py

This commit is contained in:
yatmesh
2025-08-01 09:52:58 +05:30
parent 6e0cafcecf
commit 4df63310d8
2 changed files with 76 additions and 74 deletions
@@ -263,40 +263,40 @@ async def request_oauth_authorization_url(
# URL that will take him to ICICI's official site to log in. When he logs in, ICICI will hit our callback # URL that will take him to ICICI's official site to log in. When he logs in, ICICI will hit our callback
# URL and give us the authentication details. # URL and give us the authentication details.
if inbound_data.client == "iciciBreeze": # if inbound_data.client == "iciciBreeze":
#
# Prepare the inputs: # # Prepare the inputs:
auth_url = await current_app.icici_breeze_controller.get_authorization_url(api_key = inbound_data.auth.apiKey) # auth_url = await current_app.icici_breeze_controller.get_authorization_url(api_key = inbound_data.auth.apiKey)
#
# Immediately save the details against that token id: # # Immediately save the details against that token id:
success = await current_app.icici_breeze_controller.set_token_direct( # success = await current_app.icici_breeze_controller.set_token_direct(
sql_conn = current_app.sql_writer, # sql_conn = current_app.sql_writer,
mongo_data_conn = current_app.data_mongo, # mongo_data_conn = current_app.data_mongo,
auth_token = CoreAuthTokenModel( # auth_token = CoreAuthTokenModel(
serviceType = "stockTrading", # serviceType = "stockTrading",
client = inbound_data.client, # client = inbound_data.client,
authType = "oauth", # authType = "oauth",
user = kwargs["session_info"], # user = kwargs["session_info"],
clientUserId = { # clientUserId = {
"userId": inbound_data.auth.userId, # "userId": inbound_data.auth.userId,
"apiKey": inbound_data.auth.apiKey # "apiKey": inbound_data.auth.apiKey
}, # },
auth = inbound_data.auth.model_dump(), # auth = inbound_data.auth.model_dump(),
status = "active", # status = "active",
syncFreq = None # syncFreq = None
), # ),
token_notes = { # token_notes = {
"userId": inbound_data.auth.userId, # "userId": inbound_data.auth.userId,
"apiKey": inbound_data.auth.apiKey, # "apiKey": inbound_data.auth.apiKey,
"authUrl": auth_url # "authUrl": auth_url
}, # },
display_name = inbound_data.auth.userId, # display_name = inbound_data.auth.userId,
display_picture = None, # display_picture = None,
session_token = inbound_headers["X-Session-Token"] # session_token = inbound_headers["X-Session-Token"]
) # )
#
# Check if things were successful: # # Check if things were successful:
if not success: auth_url = None # if not success: auth_url = None
# ┳┓ # ┳┓
# ┣┫┏┓┏┏┓┏┓┏┓┏┏┓ # ┣┫┏┓┏┏┓┏┓┏┓┏┏┓
@@ -471,40 +471,40 @@ async def request_oauth_authorization_update_url(
# URL that will take him to ICICI's official site to log in. When he logs in, ICICI will hit our callback # URL that will take him to ICICI's official site to log in. When he logs in, ICICI will hit our callback
# URL and give us the authentication details. # URL and give us the authentication details.
if inbound_data.client == "iciciBreeze": # if inbound_data.client == "iciciBreeze":
#
# Prepare the inputs: # # Prepare the inputs:
auth_url = await current_app.icici_breeze_controller.get_authorization_url(api_key = inbound_data.auth.apiKey) # auth_url = await current_app.icici_breeze_controller.get_authorization_url(api_key = inbound_data.auth.apiKey)
#
# Immediately save the details against that token id: # # Immediately save the details against that token id:
success = await current_app.icici_breeze_controller.set_token_direct( # success = await current_app.icici_breeze_controller.set_token_direct(
sql_conn = current_app.sql_writer, # sql_conn = current_app.sql_writer,
mongo_data_conn = current_app.data_mongo, # mongo_data_conn = current_app.data_mongo,
auth_token = CoreAuthTokenModel( # auth_token = CoreAuthTokenModel(
serviceType = "stockTrading", # serviceType = "stockTrading",
client = inbound_data.client, # client = inbound_data.client,
authType = "oauth", # authType = "oauth",
user = kwargs["session_info"], # user = kwargs["session_info"],
clientUserId = { # clientUserId = {
"userId": inbound_data.auth.userId, # "userId": inbound_data.auth.userId,
"apiKey": inbound_data.auth.apiKey # "apiKey": inbound_data.auth.apiKey
}, # },
auth = inbound_data.auth.model_dump(), # auth = inbound_data.auth.model_dump(),
status = "active", # status = "active",
syncFreq = None # syncFreq = None
), # ),
token_notes = { # token_notes = {
"userId": inbound_data.auth.userId, # "userId": inbound_data.auth.userId,
"apiKey": inbound_data.auth.apiKey, # "apiKey": inbound_data.auth.apiKey,
"authUrl": auth_url # "authUrl": auth_url
}, # },
display_name = inbound_data.auth.userId, # display_name = inbound_data.auth.userId,
display_picture = None, # display_picture = None,
session_token = inbound_headers["X-Session-Token"] # session_token = inbound_headers["X-Session-Token"]
) # )
#
# Check if things were successful: # # Check if things were successful:
if not success: auth_url = None # if not success: auth_url = None
# ┳┓ # ┳┓
# ┣┫┏┓┏┏┓┏┓┏┓┏┏┓ # ┣┫┏┓┏┏┓┏┓┏┓┏┏┓
+8 -6
View File
@@ -571,12 +571,14 @@ async def app_startup(**kwargs):
alert_url = current_app.script_data["alerts"]["url"], alert_url = current_app.script_data["alerts"]["url"],
debug = enable_debugging debug = enable_debugging
) )
current_app.icici_breeze_controller = ICICIBreezeTradingController(
cache = current_app.module_cache, # current_app.icici_breeze_controller = ICICIBreezeTradingController(
http_client = current_app.http_client, # cache = current_app.module_cache,
alert_url = current_app.script_data["alerts"]["url"], # http_client = current_app.http_client,
debug = enable_debugging # alert_url = current_app.script_data["alerts"]["url"],
) # debug = enable_debugging
# )
current_app.paper_trading_controller = PaperTradingController( current_app.paper_trading_controller = PaperTradingController(
cache = current_app.module_cache, cache = current_app.module_cache,
http_client = current_app.http_client, http_client = current_app.http_client,