Skip to content

Commit

Permalink
HGI-6349: Backoff on malformed XML error
Browse files Browse the repository at this point in the history
  • Loading branch information
hsyyid committed Aug 14, 2024
1 parent 6c1ccdd commit e75d7cf
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
1 change: 1 addition & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ install_requires =
singer-python>=5.0.12
requests>=2.20.0
xmltodict==0.12.0
backoff==1.8.0

[options.package_data]
schemas = tap_intacct/schemas/*.json
Expand Down
7 changes: 7 additions & 0 deletions src/tap_intacct/client.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
API Base class with util functions
"""
import backoff
import datetime as dt
import json
import re
Expand All @@ -10,6 +11,8 @@

import requests
import xmltodict
from xml.parsers.expat import ExpatError

from calendar import monthrange

import singer
Expand Down Expand Up @@ -121,6 +124,10 @@ def _set_session_id(self, user_id: str, company_id: str, user_password: str):
raise SageIntacctSDKError('Error: {0}'.format(response['errormessage']))

@singer.utils.ratelimit(10, 1)
@backoff.on_exception(backoff.expo,
(ExpatError),
max_tries=5,
factor=2)
def _post_request(self, dict_body: dict, api_url: str) -> Dict:
"""
Create a HTTP post request.
Expand Down

0 comments on commit e75d7cf

Please sign in to comment.