Skip to content

Commit

Permalink
Merge pull request #362 from constantine2nd/develop
Browse files Browse the repository at this point in the history
feature/Enable Logging for oauthlib
  • Loading branch information
simonredfern authored Oct 24, 2024
2 parents e106ef8 + 81ad74c commit 1160910
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion apimanager/obp/oauth.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,15 @@

from .authenticator import Authenticator, AuthenticatorError

# Set up logging
LOGGER = logging.getLogger("requests_oauthlib")
LOGGER.setLevel(logging.DEBUG) # Enable detailed logging for requests-oauthlib

LOGGER = logging.getLogger(__name__)
# Enable logging for oauthlib to capture signature creation
logging.getLogger("oauthlib").setLevel(logging.DEBUG)

# Optionally, format logging output
logging.basicConfig(level=logging.DEBUG, format='%(asctime)s %(levelname)s %(message)s')

class OAuthAuthenticator(Authenticator):
"""Implements an OAuth authenticator to the API"""
Expand All @@ -35,6 +41,7 @@ def get_authorization_url(self, callback_uri):
)
try:
url = settings.API_HOST + settings.OAUTH_TOKEN_PATH
# Fetch the request token, logging the signature details
response = session.fetch_request_token(url, verify=settings.VERIFY)
except (ValueError, TokenRequestDenied, ConnectionError) as err:
raise AuthenticatorError(err)
Expand Down

0 comments on commit 1160910

Please sign in to comment.