diff --git a/sageintacctsdk/apis/api_base.py b/sageintacctsdk/apis/api_base.py index aa9a177..10073d1 100644 --- a/sageintacctsdk/apis/api_base.py +++ b/sageintacctsdk/apis/api_base.py @@ -2,6 +2,7 @@ API Base class with util functions """ import json +import logging import datetime import uuid from warnings import warn @@ -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.""" @@ -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}) @@ -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']