Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add extensive loggers #91

Merged
merged 2 commits into from
Oct 13, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion fyle/platform/internals/api_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
Define ApiBase class implementing API helper methods.
"""

import logging
import json

from .decorators import retry
Expand All @@ -10,6 +11,8 @@
from ..globals.config import config


logger = logging.getLogger(__name__)

class ApiBase(Network):
"""The base class for all API classes."""

Expand Down Expand Up @@ -57,9 +60,11 @@ def make_get_request(self, api_url, query_params=None):
)

if response.status_code == 200:
logger.debug('Response for get request for url: %s, %s', api_url, response.text)
result = json.loads(response.text)
return result

logger.info('Response for get request for url: %s, %s', api_url, response.text)
ApiBase._assert_response(response)

@retry(n=3, backoff=5, exceptions=exceptions.InvalidTokenError)
Expand All @@ -83,10 +88,14 @@ def make_post_request(self, api_url, payload):
data=payload
)

logger.debug('Payload for post request: %s', payload)

if response.status_code == 200:
logger.debug('Response for post request: %s', response.text)
result = json.loads(response.text)
return result


logger.info('Response for post request: %s', response.text)
ApiBase._assert_response(response)


Expand Down
Loading