Skip to content

Commit

Permalink
feat: Add extensive loggers (#91)
Browse files Browse the repository at this point in the history
* feat: Add extensive loggers

* bump up version
  • Loading branch information
Ashutosh619-sudo authored Oct 13, 2024
1 parent 76bc76f commit 831d652
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
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
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

setuptools.setup(
name='fyle',
version='v0.37.1',
version='v0.37.2',
author='Siva Narayanan',
author_email='[email protected]',
description='Python SDK for accessing Fyle Platform APIs',
Expand Down

0 comments on commit 831d652

Please sign in to comment.