@@ -78,27 +78,10 @@ using them easy.
78
78
Fetching a Token and Creating a Client
79
79
--------------------------------------
80
80
81
- ``schwab-py `` provides an easy implementation of the client-side login flow in
82
- the ``auth `` package. It uses a `selenium
83
- <https://selenium-python.readthedocs.io/> `__ webdriver to open the Schwab
84
- authentication URL, take your login credentials, catch the post-login redirect,
85
- and fetch a reusable token. It returns a fully-configured :ref: `client `, ready
86
- to send API calls. It also handles token refreshing, and writes updated tokens
87
- to the token file.
88
-
89
- These functions are webdriver-agnostic, meaning you can use whatever
90
- webdriver-supported browser you have available on your system. You can find
91
- information about available webdriver on the `Selenium documentation
92
- <https://www.selenium.dev/documentation/en/getting_started_with_webdriver/
93
- browsers/> `__.
94
-
95
- .. autofunction :: schwab.auth.client_from_login_flow
96
-
97
81
.. _manual_login :
98
82
99
- If for some reason you cannot open a web browser, such as when running in a
100
- cloud environment, the following function will guide you through the process of
101
- manually creating a token by copy-pasting relevant URLs.
83
+ This function will guide you through the process of logging in and creating a
84
+ token.
102
85
103
86
.. autofunction :: schwab.auth.client_from_manual_flow
104
87
@@ -107,16 +90,10 @@ the login flow again.
107
90
108
91
.. autofunction :: schwab.auth.client_from_token_file
109
92
110
- The following is a convenient wrapper around these two methods, calling each
111
- when appropriate:
112
-
113
- .. autofunction :: schwab.auth.easy_client
114
-
115
93
If you don't want to create a client and just want to fetch a token, you can use
116
94
the ``schwab-generate-token.py `` script that's installed with the library. This
117
95
method is particularly useful if you want to create your token on one machine
118
- and use it on another. The script will attempt to open a web browser and perform
119
- the login flow. If it fails, it will fall back to the manual login flow:
96
+ and use it on another.
120
97
121
98
.. code-block :: bash
122
99
@@ -173,34 +150,6 @@ can also `join our Discord server <https://discord.gg/M3vjtHj>`__ to ask questio
173
150
174
151
175
152
176
- .. _missing_chromedriver :
177
-
178
- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
179
- ``WebDriverException: Message: 'chromedriver' executable needs to be in PATH ``
180
- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
181
-
182
- When creating a ``schwab-py `` token using a webrowser-based method like
183
- :func: `~schwab.auth.client_from_login_flow ` or :func: `~schwab.auth.easy_client `,
184
- the library must control the browser using `selenium
185
- <https://selenium-python.readthedocs.io/> `__. This is a Python library that
186
- sends commands to the browser to perform operations like load pages, inject
187
- synthetic clicks, enter text, and so on. The component which is used to send
188
- these commands is called a *driver *.
189
-
190
- Drivers are generally not part of the standard web browser installation, meaning
191
- you must install them manually. If you're seeing this or a similar message, you
192
- probably haven't installed the appropriate webdriver. Drivers are
193
- available for most of the common web browsers, including `Chrome
194
- <https://chromedriver.chromium.org/getting-started/> `__, `Firefox
195
- <https://github.com/mozilla/geckodriver/releases> `__, and `Safari
196
- <https://developer.apple.com/documentation/webkit/testing_with_webdriver_in_safari> `__.
197
- Make sure you've installed the driver *before * attempting to create a token
198
- using ``schwab-py ``.
199
-
200
-
201
- .. _invalid_grant :
202
-
203
-
204
153
++++++++++++++++++++++
205
154
Token Parsing Failures
206
155
++++++++++++++++++++++
@@ -228,26 +177,3 @@ you're confident is valid, please `file a ticket
228
177
<https://github.com/alexgolec/schwab-py/issues> `__. Just remember, **never share
229
178
your token file, not even with ** ``schwab-py `` **developers **. Sharing the token
230
179
file is as dangerous as sharing your Schwab username and password.
231
-
232
-
233
- ++++++++++++++++++++++++++++++
234
- What If I Can't Use a Browser?
235
- ++++++++++++++++++++++++++++++
236
-
237
- Launching a browser can be inconvenient in some situations, most notably in
238
- containerized applications running on a cloud provider. ``schwab-py `` supports
239
- two alternatives to creating tokens by opening a web browser.
240
-
241
- Firstly, the :ref: `manual login flow<manual_login> ` flow allows you to go
242
- through the login flow on a different machine than the one on which
243
- ``schwab-py `` is running. Instead of starting the web browser and automatically
244
- opening the relevant URLs, this flow allows you to manually copy-paste around
245
- the URLs. It's a little more cumbersome, but it has no dependency on selenium.
246
-
247
- Alterately, you can take advantage of the fact that token files are portable.
248
- Once you create a token on one machine, such as one where you can open a web
249
- browser, you can easily copy that token file to another machine, such as your
250
- application in the cloud. However, make sure you don't use the same token on
251
- two machines. It is recommended to delete the token created on the
252
- browser-capable machine as soon as it is copied to its destination.
253
-
0 commit comments