diff options
author | Jonathan Huot <JonathanHuot@users.noreply.github.com> | 2019-04-26 22:44:19 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-04-26 22:44:19 +0200 |
commit | f1b8781e9f9dbce18ba67bbdf8f122109c5650d3 (patch) | |
tree | d197a477345dfeb34df0afe34e3640c815b033e1 /oauthlib | |
parent | 91a2792da6e968fa72d871b2f0b95a8734f40546 (diff) | |
parent | 30321dd3c0ca784d3508a1970cf90d9f76835c79 (diff) | |
download | oauthlib-f1b8781e9f9dbce18ba67bbdf8f122109c5650d3.tar.gz |
Merge branch 'master' into oidc-hashes
Diffstat (limited to 'oauthlib')
-rw-r--r-- | oauthlib/__init__.py | 17 | ||||
-rw-r--r-- | oauthlib/common.py | 3 |
2 files changed, 20 insertions, 0 deletions
diff --git a/oauthlib/__init__.py b/oauthlib/__init__.py index 8eb82a6..0e413bc 100644 --- a/oauthlib/__init__.py +++ b/oauthlib/__init__.py @@ -15,3 +15,20 @@ __author__ = 'The OAuthlib Community' __version__ = '3.0.2-dev' logging.getLogger('oauthlib').addHandler(NullHandler()) + +_DEBUG = False + +def set_debug(debug_val): + """Set value of debug flag + + :param debug_val: Value to set. Must be a bool value. + """ + global _DEBUG + _DEBUG = debug_val + +def get_debug(): + """Get debug mode value. + + :return: `True` if debug mode is on, `False` otherwise + """ + return _DEBUG diff --git a/oauthlib/common.py b/oauthlib/common.py index 96de1f1..5aeb015 100644 --- a/oauthlib/common.py +++ b/oauthlib/common.py @@ -14,6 +14,7 @@ import logging import re import sys import time +from . import get_debug try: from secrets import randbits @@ -435,6 +436,8 @@ class Request(object): raise AttributeError(name) def __repr__(self): + if not get_debug(): + return "<oauthlib.Request SANITIZED>" body = self.body headers = self.headers.copy() if body: |