Compare commits

...

2 Commits

2 changed files with 8 additions and 2 deletions

3
.gitignore vendored
View File

@ -1 +1,2 @@
.env .env
__pycache__/

View File

@ -10,7 +10,7 @@ load_dotenv()
class TradeStationClient: class TradeStationClient:
def __init__(self) -> None: def __init__(self, refresh_token: str = None) -> None:
self.id = getenv('TRADESTATION_CLIENT_ID') self.id = getenv('TRADESTATION_CLIENT_ID')
self.redirect_uri = getenv('TRADESTATION_REDIRECT_URI') self.redirect_uri = getenv('TRADESTATION_REDIRECT_URI')
self.scope = getenv('TRADESTATION_CLIENT_SCOPE') self.scope = getenv('TRADESTATION_CLIENT_SCOPE')
@ -23,6 +23,11 @@ class TradeStationClient:
self.id_token = None self.id_token = None
self.refresh_token = None self.refresh_token = None
# For bypassing normal authorization flow.
if refresh_token:
self.refresh_token = refresh_token
self.refresh_access_token()
def open_authorization_url(self): def open_authorization_url(self):
""" """
Open the TradeStation authorization URL in the default web browser. Open the TradeStation authorization URL in the default web browser.