(20250104) Breeze authorization will be accepted now.

This commit is contained in:
2025-01-04 15:22:51 +05:30
parent aadcc87e2a
commit 0c2d7816f4
13 changed files with 316 additions and 83 deletions
+28 -8
View File
@@ -101,18 +101,24 @@ class PaperTradingAuth(BaseModel):
class ZerodhaKiteAuth(BaseModel):
userId: str = Field(
description = "How Zerodha's Kite platform identifies this user.",
frozen = True,
alias = "clientId"
)
apiKey: str = Field(
description = (
"the api key of your kite connect app; "
"this remains constant throughout the life of the app"
"The API key of your Kite app. "
"This remains constant throughout the life of the app."
),
frozen = True
)
apiSecret: str = Field(
description = (
"the api secret of your kite connect app; "
"this can change if you think the security of your app has been compromised"
"The API secret of your Kite app. "
"This can be changed if you think the security of your app has been compromised."
),
frozen = True
)
@@ -124,6 +130,7 @@ class ZerodhaKiteAuth(BaseModel):
class Config:
extra = "forbid"
populate_by_name = True
# ---------------------------------------------------------------------------------------------------------------------
@@ -131,13 +138,25 @@ class ZerodhaKiteAuth(BaseModel):
class ICICIBreezeAuth(BaseModel):
userId: str = Field(
description = "How ICICI's Breeze platform identifies this user.",
frozen = True,
alias = "clientId"
)
apiKey: str = Field(
description = "??",
description = (
"The API key of your Breeze app. "
"This remains constant throughout the life of the app."
),
frozen = True
)
apiSecret: str = Field(
description = "??",
description = (
"The API secret of your Breeze app. "
"This can be changed if you think the security of your app has been compromised."
),
frozen = True
)
@@ -148,6 +167,7 @@ class ICICIBreezeAuth(BaseModel):
class Config:
extra = "forbid"
populate_by_name = True
# ---------------------------------------------------------------------------------------------------------------------
@@ -179,8 +199,8 @@ class TradingAuthRequestHeaders(BaseModel):
class TradingAuthRequestData(BaseModel):
client: Literal["zerodhaKite", "iciciBreeze", "paperTrading"] = Field(alias = "client")
auth: Union[ZerodhaKiteAuth, ICICIBreezeAuth, PaperTradingAuth]
client: Literal["paperTrading", "zerodhaKite", "iciciBreeze"] = Field(alias = "client")
auth: Union[PaperTradingAuth, ZerodhaKiteAuth, ICICIBreezeAuth]
# ┏┓ ┏•
# ┃ ┏┓┏┓╋┓┏┓
+127
View File
@@ -0,0 +1,127 @@
"""
AUTHOR:
Khushal P Soonderji
DATE:
Saturday, 4th Jan., 2025.
OBJECTIVE:
To provide a structure to represent OAuth callback responses.
REFERENCES:
N/A
DOWNLOADS:
N/A
"""
# *****************************************************************************************************************
# ***** ****
# *** IMPORT ***
# ***** ****
# *****************************************************************************************************************
# To make sibling directories accessible for imports:
import sys
sys.path.append(".")
sys.path.append("..")
# For making data behaviour_models:
from pydantic import BaseModel, Field, field_validator, PastDatetime, model_validator, AwareDatetime
from typing import Optional, Literal, Union, List, Any
# My utils:
from utils_v2.string import regex
from utils_v2.date_time import date_time
# To work with date and time:
import datetime
# *****************************************************************************************************************
# ***** ****
# *** MACROS / ONE-TIME INIT ***
# ***** ****
# *****************************************************************************************************************
# --- Nothing Yet
# *****************************************************************************************************************
# ***** ****
# *** VARIABLES ***
# ***** ****
# *****************************************************************************************************************
# --- Nothing Yet
# *****************************************************************************************************************
# ***** ****
# *** FUNCTIONS ***
# ***** ****
# *****************************************************************************************************************
class TradingOAuthCallbackResponse(BaseModel):
success: bool = Field(
description = "To indicate whether or not, the action was a success",
frozen = False,
default = False
)
message: str = Field(
description = "To explain what happened in the process of handling the OAuth callback.",
frozen = False,
default = "ERR: Message not captured."
)
exception: Any = Field(
description = "To pass on any exception that occurred in the process.",
frozen = False,
default = None
)
# ┏┓ ┏•
# ┃ ┏┓┏┓╋┓┏┓
# ┗┛┗┛┛┗┛┗┗┫
# ┛
class Config:
extra = "forbid"
# ┏┓ ┏┓
# ┃ ┓┏┏╋┏┓┏┳┓ ┣ ┓┏┏┓┏┏
# ┗┛┗┻┛┗┗┛┛┗┗ ┻ ┗┻┛┗┗┛
pass
# ┓┏ ┓• ┓ •
# ┃┃┏┓┃┓┏┫┏┓╋┓┏┓┏┓
# ┗┛┗┻┗┗┗┻┗┻┗┗┗┛┛┗
pass
# *****************************************************************************************************************
# ***** ****
# *** MAIN PROGRAM ***
# ***** ****
# *****************************************************************************************************************
if __name__ == "__main__":
pass