requests / requests-oauthlib

OAuthlib support for Python-Requests!
https://requests-oauthlib.readthedocs.org/
ISC License
1.72k stars 424 forks source link

Redo request after token is updated #510

Open ewtoombs opened 1 year ago

ewtoombs commented 1 year ago

https://github.com/requests/requests-oauthlib/blob/3a2a852e33c691c7e793300ce366a01b6e4b3848/requests_oauthlib/oauth2_session.py#L541

Seriously, why can't we just redo the request? That's what everybody's going to be doing anyway. Every project using this code is just going to write

result = None
while True:
    try:
        result = session.request(...)
    except TokenUpdated:
        pass