schwab-py
schwab-py copied to clipboard
Split `client_from_manual_flow` into "get URL" and "create token from response URL" components
Description of Bug Attempting to use the demonstration code for generating a token and authenticating within a jupyterlab notebook is warning that this is not a terminal environment and crashes. I can get the code to work from within a terminal. Perhaps related to the use of "prompt" rather than "input" ?
Code to Reproduce c = schwab.auth.client_from_manual_flow(APP_KEY, app_secret=SECRET, callback_url=CALLBACK , token_path=TOKEN_PATH )
Expected Behavior User can authenticate from within a jupyter notebook
Actual Behavior Code crashes on running
Error/Exception Log, If Applicable
File [/opt/conda/lib/python3.11/site-packages/schwab/auth.py:221](http://0.0.0.0:8888/opt/conda/lib/python3.11/site-packages/schwab/auth.py#line=220), in client_from_manual_flow(api_key, app_secret, callback_url, token_path, asyncio, token_write_func, enforce_enums)
214 if callback_url.startswith('http://'):
215 print(('WARNING: Your callback URL ({}) will transmit data over HTTP, ' +
216 'which is a potentially severe security vulnerability. ' +
217 'Please go to your app\'s configuration with TDAmeritrade ' +
218 'and update your callback URL to begin with \'https\' ' +
219 'to stop seeing this message.').format(callback_url))
### **--> 221 redirected_url = prompt('Redirect URL> ').strip()**
223 return __fetch_and_register_token_from_redirect(
224 oauth, redirected_url, api_key, app_secret, token_path, token_write_func,
225 asyncio, enforce_enums=enforce_enums)