Skip to content

Commit

Permalink
Merge pull request #63 from openzim/authenticate_logs
Browse files Browse the repository at this point in the history
Add more debug logs around authentication issues
  • Loading branch information
benoit74 authored Jul 23, 2024
2 parents 8ed06eb + 5ec7e7e commit 08d9ee4
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions api/src/zimfarm.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,11 @@ def query_api(method, path, payload=None, params=None):

# Unauthorised error: attempt to re-auth as scheduler might have restarted?
if req.status_code == 401:
logger.debug(f"Request {method} {path} failed with 401: {resp}")
logger.debug(f"Forcing reauth")
logger.debug(f"Old token was {len(TokenData.ACCESS_TOKEN)} chars long")
logger.debug(f"Old token was expiring at {TokenData.ACCESS_TOKEN_EXPIRY}")
logger.debug(f"Now time is {datetime.datetime.now()}")
authenticate(True)

reason = resp["error"] if "error" in resp else str(resp)
Expand Down

0 comments on commit 08d9ee4

Please sign in to comment.