summaryrefslogtreecommitdiff
path: root/oauthlib
diff options
context:
space:
mode:
authorJonathan Huot <JonathanHuot@users.noreply.github.com>2019-04-26 22:44:19 +0200
committerGitHub <noreply@github.com>2019-04-26 22:44:19 +0200
commitf1b8781e9f9dbce18ba67bbdf8f122109c5650d3 (patch)
treed197a477345dfeb34df0afe34e3640c815b033e1 /oauthlib
parent91a2792da6e968fa72d871b2f0b95a8734f40546 (diff)
parent30321dd3c0ca784d3508a1970cf90d9f76835c79 (diff)
downloadoauthlib-f1b8781e9f9dbce18ba67bbdf8f122109c5650d3.tar.gz
Merge branch 'master' into oidc-hashes
Diffstat (limited to 'oauthlib')
-rw-r--r--oauthlib/__init__.py17
-rw-r--r--oauthlib/common.py3
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: