Skip to content

Commit 4eaf5b2

Browse files
committed
feat!: make Client.request tries argument private
1 parent 8e66f30 commit 4eaf5b2

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

hcloud/_client.py

+6-6
Original file line numberDiff line numberDiff line change
@@ -189,14 +189,14 @@ def request( # type: ignore[no-untyped-def]
189189
self,
190190
method: str,
191191
url: str,
192-
tries: int = 1,
192+
*,
193+
_tries: int = 1,
193194
**kwargs,
194195
) -> dict:
195196
"""Perform a request to the Hetzner Cloud API, wrapper around requests.request
196197
197198
:param method: HTTP Method to perform the Request
198199
:param url: URL of the Endpoint
199-
:param tries: Tries of the request (used internally, should not be set by the user)
200200
:param timeout: Requests timeout in seconds
201201
:return: Response
202202
"""
@@ -220,10 +220,10 @@ def request( # type: ignore[no-untyped-def]
220220
if not response.ok:
221221
if content:
222222
assert isinstance(content, dict)
223-
if content["error"]["code"] == "rate_limit_exceeded" and tries < 5:
224-
time.sleep(tries * self._retry_wait_time)
225-
tries = tries + 1
226-
return self.request(method, url, tries, **kwargs)
223+
if content["error"]["code"] == "rate_limit_exceeded" and _tries < 5:
224+
time.sleep(_tries * self._retry_wait_time)
225+
_tries = _tries + 1
226+
return self.request(method, url, _tries=_tries, **kwargs)
227227

228228
self._raise_exception_from_content(content)
229229
else:

0 commit comments

Comments
 (0)