Skip to content

Commit 416fd98

Browse files
vdusekclaude
andauthored
fix: use explicit None checks for client config to respect zero values (#623)
## Summary - `max_retries`, `min_delay_between_retries_millis`, and `timeout_secs` used `or` for defaults - The `or` operator treats `0` as falsy, so `max_retries=0` silently became `8`, `timeout_secs=0` became `360`, etc. - Changed to `if x is not None else default` pattern to correctly respect explicit zero values ## Test plan - [ ] Verify existing unit tests pass - [ ] Verify `ApifyClient(token='x', max_retries=0)` results in `client.max_retries == 0` Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
1 parent fc4eed7 commit 416fd98

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/apify_client/client.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -89,9 +89,11 @@ def __init__(
8989
self.base_url = f'{api_url}/{API_VERSION}'
9090
api_public_url = (api_public_url or DEFAULT_API_URL).rstrip('/')
9191
self.public_base_url = f'{api_public_url}/{API_VERSION}'
92-
self.max_retries = max_retries or 8
93-
self.min_delay_between_retries_millis = min_delay_between_retries_millis or 500
94-
self.timeout_secs = timeout_secs or DEFAULT_TIMEOUT
92+
self.max_retries = max_retries if max_retries is not None else 8
93+
self.min_delay_between_retries_millis = (
94+
min_delay_between_retries_millis if min_delay_between_retries_millis is not None else 500
95+
)
96+
self.timeout_secs = timeout_secs if timeout_secs is not None else DEFAULT_TIMEOUT
9597

9698
def _options(self) -> dict:
9799
return {

0 commit comments

Comments
 (0)