diff --git a/CHANGELOG.md b/CHANGELOG.md index 0819f3a..6dcf599 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. - CLI modified - Dependencies structure modified - Test system modified +- `_attempt_with_retries` function modified ## [0.8] - 2026-02-05 ### Added - Support [wtfismyip.com](https://wtfismyip.com/json) IPv6 API diff --git a/ipspot/utils.py b/ipspot/utils.py index 427e15f..e2c6122 100644 --- a/ipspot/utils.py +++ b/ipspot/utils.py @@ -91,10 +91,14 @@ def _attempt_with_retries( next_delay = retry_delay for attempt in range(max_retries + 1): result = func(**kwargs) + if result["status"]: - break - time.sleep(next_delay) - next_delay *= backoff_factor + return result + + if attempt < max_retries: + time.sleep(next_delay) + next_delay *= backoff_factor + return result