Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
typo
  • Loading branch information
axshani committed Oct 24, 2022
commit 49b2c83c7ed0a9154181c94debc705210189dc74
6 changes: 3 additions & 3 deletions unit/api/base_resource.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ def __init__(self, api_url, token, retries_amount):
"authorization": f"Bearer {self.token}",
"user-agent": "unit-python-sdk"
}
# max_tries must be greater than 0 due to infinite loop of backoff library otherwise
# max_tries must be greater than 0 due to an infinite loop of backoff library otherwise
_retries = retries_amount if retries_amount > 1 else 1

@backoff.on_predicate(backoff.expo,
Expand All @@ -67,8 +67,8 @@ def get(self, resource: str, params: Dict = None, headers: Optional[Dict[str, st
jitter=backoff.random_jitter)
def post(self, resource: str, data: Optional[Dict] = None, headers: Optional[Dict[str, str]] = None):
data = json.dumps(data, cls=UnitEncoder) if data is not None else None
return requests.post(f"{self.api_url}/{resource}", data=data, headers=self.__merge_headers(headers)) \
\
return requests.post(f"{self.api_url}/{resource}", data=data, headers=self.__merge_headers(headers))

@backoff.on_predicate(backoff.expo,
backoff_idempotency_key_handler,
max_tries=get_max_retries,
Expand Down