(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 and give us the authentication details.
if inbound_data.client == "iciciBreeze":
# Prepare the inputs:
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:
success = await current_app.icici_breeze_controller.set_token_direct(
sql_conn = current_app.sql_writer,
mongo_data_conn = current_app.data_mongo,
auth_token = CoreAuthTokenModel(
serviceType = "stockTrading",
client = inbound_data.client,
authType = "oauth",
user = kwargs["session_info"],
clientUserId = {
"userId": inbound_data.auth.userId,
"apiKey": inbound_data.auth.apiKey
},
auth = inbound_data.auth.model_dump(),
status = "active",
syncFreq = None
),
token_notes = {
"userId": inbound_data.auth.userId,
"apiKey": inbound_data.auth.apiKey,
"authUrl": auth_url
},
display_name = inbound_data.auth.userId,
display_picture = None,
session_token = inbound_headers["X-Session-Token"]
)
# Check if things were successful:
if not success: auth_url = None
# if inbound_data.client == "iciciBreeze":
#
# # Prepare the inputs:
# 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:
# success = await current_app.icici_breeze_controller.set_token_direct(
# sql_conn = current_app.sql_writer,
# mongo_data_conn = current_app.data_mongo,
# auth_token = CoreAuthTokenModel(
# serviceType = "stockTrading",
# client = inbound_data.client,
# authType = "oauth",
# user = kwargs["session_info"],
# clientUserId = {
# "userId": inbound_data.auth.userId,
# "apiKey": inbound_data.auth.apiKey
# },
# auth = inbound_data.auth.model_dump(),
# status = "active",
# syncFreq = None
# ),
# token_notes = {
# "userId": inbound_data.auth.userId,
# "apiKey": inbound_data.auth.apiKey,
# "authUrl": auth_url
# },
# display_name = inbound_data.auth.userId,
# display_picture = None,
# session_token = inbound_headers["X-Session-Token"]
# )
#
# # Check if things were successful:
# 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 and give us the authentication details.
if inbound_data.client == "iciciBreeze":
# Prepare the inputs:
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:
success = await current_app.icici_breeze_controller.set_token_direct(
sql_conn = current_app.sql_writer,
mongo_data_conn = current_app.data_mongo,
auth_token = CoreAuthTokenModel(
serviceType = "stockTrading",
client = inbound_data.client,
authType = "oauth",
user = kwargs["session_info"],
clientUserId = {
"userId": inbound_data.auth.userId,
"apiKey": inbound_data.auth.apiKey
},
auth = inbound_data.auth.model_dump(),
status = "active",
syncFreq = None
),
token_notes = {
"userId": inbound_data.auth.userId,
"apiKey": inbound_data.auth.apiKey,
"authUrl": auth_url
},
display_name = inbound_data.auth.userId,
display_picture = None,
session_token = inbound_headers["X-Session-Token"]
)
# Check if things were successful:
if not success: auth_url = None
# if inbound_data.client == "iciciBreeze":
#
# # Prepare the inputs:
# 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:
# success = await current_app.icici_breeze_controller.set_token_direct(
# sql_conn = current_app.sql_writer,
# mongo_data_conn = current_app.data_mongo,
# auth_token = CoreAuthTokenModel(
# serviceType = "stockTrading",
# client = inbound_data.client,
# authType = "oauth",
# user = kwargs["session_info"],
# clientUserId = {
# "userId": inbound_data.auth.userId,
# "apiKey": inbound_data.auth.apiKey
# },
# auth = inbound_data.auth.model_dump(),
# status = "active",
# syncFreq = None
# ),
# token_notes = {
# "userId": inbound_data.auth.userId,
# "apiKey": inbound_data.auth.apiKey,
# "authUrl": auth_url
# },
# display_name = inbound_data.auth.userId,
# display_picture = None,
# session_token = inbound_headers["X-Session-Token"]
# )
#
# # Check if things were successful:
# 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"],
debug = enable_debugging
)
current_app.icici_breeze_controller = ICICIBreezeTradingController(
cache = current_app.module_cache,
http_client = current_app.http_client,
alert_url = current_app.script_data["alerts"]["url"],
debug = enable_debugging
)
# current_app.icici_breeze_controller = ICICIBreezeTradingController(
# cache = current_app.module_cache,
# http_client = current_app.http_client,
# alert_url = current_app.script_data["alerts"]["url"],
# debug = enable_debugging
# )
current_app.paper_trading_controller = PaperTradingController(
cache = current_app.module_cache,
http_client = current_app.http_client,