Skip to content

Commit 424adf0

Browse files
authored
Merge pull request #522 from PaulWay/paulway_oauth2_worker_docs_fixes
Put OAuth2Session in 'oauth' consistently in examples
2 parents 206f8e5 + c61d1a0 commit 424adf0

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

docs/oauth2_workflow.rst

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -249,13 +249,13 @@ is necessary but refreshing is done manually.
249249
>>> from requests_oauthlib import OAuth2Session
250250
>>> from oauthlib.oauth2 import TokenExpiredError
251251
>>> try:
252-
... client = OAuth2Session(client_id, token=token)
253-
... r = client.get(protected_url)
252+
... oauth = OAuth2Session(client_id, token=token)
253+
... r = oauth.get(protected_url)
254254
>>> except TokenExpiredError as e:
255-
... token = client.refresh_token(refresh_url, **extra)
255+
... token = oauth.refresh_token(refresh_url, **extra)
256256
... token_saver(token)
257-
>>> client = OAuth2Session(client_id, token=token)
258-
>>> r = client.get(protected_url)
257+
>>> oauth = OAuth2Session(client_id, token=token)
258+
>>> r = oauth.get(protected_url)
259259
260260
(Second) Define automatic token refresh automatic but update manually
261261
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -268,9 +268,9 @@ is done manually.
268268
269269
>>> from requests_oauthlib import OAuth2Session, TokenUpdated
270270
>>> try:
271-
... client = OAuth2Session(client_id, token=token,
271+
... oauth = OAuth2Session(client_id, token=token,
272272
... auto_refresh_kwargs=extra, auto_refresh_url=refresh_url)
273-
... r = client.get(protected_url)
273+
... r = oauth.get(protected_url)
274274
>>> except TokenUpdated as e:
275275
... token_saver(e.token)
276276
@@ -284,9 +284,9 @@ however that you still need to update ``expires_in`` to trigger the refresh.
284284
.. code-block:: pycon
285285
286286
>>> from requests_oauthlib import OAuth2Session
287-
>>> client = OAuth2Session(client_id, token=token, auto_refresh_url=refresh_url,
287+
>>> oauth = OAuth2Session(client_id, token=token, auto_refresh_url=refresh_url,
288288
... auto_refresh_kwargs=extra, token_updater=token_saver)
289-
>>> r = client.get(protected_url)
289+
>>> r = oauth.get(protected_url)
290290
291291
TLS Client Authentication
292292
-------------------------

0 commit comments

Comments
 (0)