Last active
May 11, 2024 18:57
-
-
Save hn4002/203e40fd6e680a0df62459c83ac4e3d6 to your computer and use it in GitHub Desktop.
schwab-py: Script for the weekly manual oauth flow
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # This script is used to manually authenticate the user with the Schwab API. | |
| # Delete the token file before running this script. | |
| import schwab | |
| from environment.instance_settings import schwabSettings | |
| client_id = schwabSettings.SCHWAB_APP_ID | |
| client_secret = schwabSettings.SCHWAB_APP_SECRET | |
| redirect_uri = schwabSettings.SCHWAB_REDIRECT_URI | |
| token_path = schwabSettings.SCHWAB_TOKEN_PATH | |
| #=============================================================================== | |
| def manual_auth(): | |
| client = schwab.auth.client_from_manual_flow( | |
| api_key=client_id, | |
| app_secret=client_secret, | |
| callback_url=redirect_uri, | |
| token_path=token_path | |
| ) | |
| #=============================================================================== | |
| if __name__ == '__main__': | |
| manual_auth() | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment