Skip to content

Commit

Permalink
chore: This is also an indication of an expired token. Refs #1345
Browse files Browse the repository at this point in the history
  • Loading branch information
ecederstrand committed Dec 20, 2024
1 parent 7da64d7 commit b63353d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions exchangelib/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
import requests.exceptions
from defusedxml.expatreader import DefusedExpatParser
from defusedxml.sax import _InputSource
from oauthlib.oauth2 import TokenExpiredError
from oauthlib.oauth2 import InvalidClientIdError, TokenExpiredError
from pygments import highlight
from pygments.formatters.terminal import TerminalFormatter
from pygments.lexers.html import XmlLexer
Expand Down Expand Up @@ -831,7 +831,7 @@ def post_ratelimited(protocol, session, url, headers, data, stream=False, timeou
protocol.retire_session(session)
log.debug("Session %s thread %s: connection error POST'ing to %s", session.session_id, thread_id, url)
raise ErrorTimeoutExpired(f"Reraised from {e.__class__.__name__}({e})")
except TokenExpiredError:
except (InvalidClientIdError, TokenExpiredError):
log.debug("Session %s thread %s: OAuth token expired; refreshing", session.session_id, thread_id)
protocol.release_session(protocol.refresh_credentials(session))
raise
Expand Down

0 comments on commit b63353d

Please sign in to comment.