Skip to content

Commit

Permalink
feat: Add extensive loggers
Browse files Browse the repository at this point in the history
  • Loading branch information
Ashutosh619-sudo committed Oct 8, 2024
1 parent 76bc76f commit 0b5f104
Showing 1 changed file with 10 additions and 1 deletion.
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

0 comments on commit 0b5f104

Please sign in to comment.