Skip to content

Commit

Permalink
HGI-7048: Remove response logs
Browse files Browse the repository at this point in the history
  • Loading branch information
keyn4 committed Jan 13, 2025
1 parent 0bc6e8b commit a050ebf
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions src/tap_intacct/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,16 +170,13 @@ def _post_request(self, dict_body: dict, api_url: str) -> Dict:
api_headers = {'content-type': 'application/xml'}
api_headers.update(self.__headers)
body = xmltodict.unparse(dict_body)
logger.info(f"request to {api_url} with body {body}")
response = requests.post(api_url, headers=api_headers, data=body)

logger.info(
f"request to {api_url} response {response.text}, statuscode {response.status_code}"
)
try:
parsed_xml = xmltodict.parse(response.text)
parsed_response = json.loads(json.dumps(parsed_xml))
except:
logger.info(f"Request to {api_url} failed with body: {dict_body}")
if response.status_code == 502:
raise BadGatewayError(
f"Response status code: {response.status_code}, response: {response.text}"
Expand Down Expand Up @@ -217,7 +214,7 @@ def _post_request(self, dict_body: dict, api_url: str) -> Dict:
if api_response['result']['status'] == 'success':
return api_response

logger.error(f"Intacct error response: {api_response}")
logger.error(f"Intacct error response: {api_response}, request body: {dict_body}")
error = api_response.get('result', {}).get('errormessage', {}).get('error', {})
desc_2 = error.get("description2") if isinstance(error, dict) else error[0].get("description2") if isinstance(error, list) and error else ""
if (
Expand All @@ -235,6 +232,7 @@ def _post_request(self, dict_body: dict, api_url: str) -> Dict:
exception_msg = parsed_response.get("response", {}).get("errormessage", {}).get("error", {})
correction = exception_msg.get("correction", {})

logger.info(f"Request to {api_url} failed with body {dict_body}")
if response.status_code == 400:
if exception_msg.get("errorno") == "GW-0011":
raise AuthFailure(f'One or more authentication values are incorrect. Response:{parsed_response}')
Expand Down

0 comments on commit a050ebf

Please sign in to comment.