Skip to content
This repository has been archived by the owner on Jan 9, 2023. It is now read-only.

Commit

Permalink
fix(session): redact token from debug output
Browse files Browse the repository at this point in the history
  • Loading branch information
claylo committed Jan 5, 2016
1 parent 5cf1570 commit 073a116
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions smartsheet/session.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,12 @@ def pinned_session(pool_maxsize=8):
pool_maxsize=pool_maxsize)

_session = requests.session()
_session.hooks = {'response': redact_token}
_session.mount('https://', http_adapter)

return _session

def redact_token(res, *args, **kwargs):
if 'Authorization' in res.request.headers:
res.request.headers.update({'Authorization': '[redacted]'})
return res

0 comments on commit 073a116

Please sign in to comment.