schwab-generate-token
is a tool to fetch a new token from the Schwab API and write it to a file. The tool can be run using command-line arguments or by prompting the user for input.
You can run the script directly with the required arguments:
pip install -r requirements.txt
python schwab-generate-token.py --api_key YOUR_API_KEY --app_secret YOUR_APP_SECRET --callback_url CALLBACK_URL --token_file TOKEN_FILE_NAME
Alternatively, you can run the script using the schwab-generate-token.exe
in Releases on Windows platform. This will open a command prompt window and prompt you for the required arguments.
If you want to compile this executable file manually, you can use PyInstaller:
pip install pyinstaller
pyinstaller --onefile --clean --distpath=temp\dist --workpath=temp\build --console schwab-generate-token.py
--api_key
: The API Key for the Schwab API.--app_secret
: The App Secret for the Schwab API.--callback_url
: The callback URL, default ishttps://127.0.0.1:8182
.--token_file
: The path to the token file, default is_schwab_token.json
.
- Ensure that the provided
API Key
andApp Secret
are valid. - The
Callback URL
must match the callback URL configured in the Charles Schwab Developer Portal.