Skip to content

Commit

Permalink
feat: Added Extensive Loggers
Browse files Browse the repository at this point in the history
  • Loading branch information
Ashutosh619-sudo committed Oct 3, 2024
1 parent f4cdf4c commit 7dc9acf
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions sageintacctsdk/apis/api_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
API Base class with util functions
"""
import json
import logging
import datetime
import uuid
from warnings import warn
Expand All @@ -17,6 +18,9 @@
from .constants import dimensions_fields_mapping


logger = logging.getLogger(__name__)
logger.level = logging.WARNING

class ApiBase:
"""The base class for all API classes."""

Expand Down Expand Up @@ -186,6 +190,7 @@ def __post_request(self, dict_body: dict, api_url: str):
A response from the request (dict).
"""

logger.debug('Payload for post request: %s', dict_body)
raw_response = self.__post_request_for_raw_response(dict_body, api_url)
try:
parsed_xml = xmltodict.parse(raw_response.text, force_list={self.__dimension})
Expand All @@ -195,6 +200,8 @@ def __post_request(self, dict_body: dict, api_url: str):
parsed_xml = xmltodict.parse(raw_response, force_list={self.__dimension})['root']
parsed_response = json.loads(json.dumps(parsed_xml))


logger.debug('Response for post request: %s', raw_response.text)
if raw_response.status_code == 200:
if parsed_response['response']['control']['status'] == 'success':
api_response = parsed_response['response']['operation']
Expand Down

0 comments on commit 7dc9acf

Please sign in to comment.