Skip to content

Commit

Permalink
fix: handle single record responses (#18)
Browse files Browse the repository at this point in the history
  • Loading branch information
pnadolny13 authored Dec 16, 2024
1 parent 95f96da commit bd9f721
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion tap_intacct/streams.py
Original file line number Diff line number Diff line change
Expand Up @@ -393,7 +393,11 @@ def parse_response(self, response: requests.Response) -> t.Iterable[dict]: # no
)

if api_response["result"]["status"] == "success":
return api_response["result"]["data"].get(self.intacct_obj_name, [])
records = api_response["result"]["data"].get(self.intacct_obj_name, [])
# Intacct returns a dict when only 1 object is found.
if isinstance(records, dict):
return [records]
return records

self.logger.error("Intacct error response: %s", api_response)
error = api_response.get("result", {}).get("errormessage", {}).get("error", {})
Expand Down

0 comments on commit bd9f721

Please sign in to comment.