feat: configurable timeout + auto-retry for headless login#10
Open
okuegow wants to merge 1 commit into
Open
Conversation
The Bluelink backend often needs a warm-up on the first call after a quiet period (cold session). Reported by Genesis users in evcc-io/evcc#30223 but applies to all brands. Changes: - headless_login() now accepts a timeout= keyword (default 30s) and passes it to all four HTTP calls. Previous behaviour relied on curl_cffi's ~10s default. - main() exposes --timeout <s> and --retries <n> (default 1, i.e. one retry after a failure = two attempts total). - main() wraps headless_login() in a retry loop that only catches transport errors (curl_cffi RequestException / OSError). Auth failures and HTTP-status problems still sys.exit immediately, so retries do not paper over real errors. No change to the browser flow.
2 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The Bluelink backend often needs a warm-up on the first call after a quiet period (cold session); curl_cffi's default ~10s timeout then surfaces as a hard failure. Reported by Genesis users in evcc-io/evcc#30223 but applies to all brands — Kia/Hyundai owners with a car that sleeps will hit the same cold-call symptom.
What changes
headless_login()gains atimeout=30keyword argument and passes it to all four HTTP calls (authorize / certs / signin / token-exchange). Previous behaviour relied on curl_cffi's ~10s default.main()exposes two new CLI flags:--timeout <seconds>— default 30, bump to 60+ on slow networks.--retries <n>— default 1 (= one retry after a failure, two attempts total). Use 0 to disable retries.main()wrapsheadless_login()in a retry loop that only catches transport errors (curl_cffi.requests.exceptions.RequestException/OSError). Auth failures, missingcodein redirect, HTTP-status problems etc. stillsys.exitfrom insideheadless_login(), so retries do not paper over real errors.Why these defaults
Compatibility
Independent of #9 (Genesis brand) — they don't touch the same lines.