fix: Kraken email/api_key auth silent failure when both auth mixins are present#3737
Open
fix: Kraken email/api_key auth silent failure when both auth mixins are present#3737
Conversation
…ixins are present Agent-Logs-Url: https://github.com/springfall2008/batpred/sessions/2084272c-dbbe-462e-8b42-9db2d65357ad Co-authored-by: springfall2008 <48591903+springfall2008@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix kraken EON error for tariff retrieval
fix: Kraken email/api_key auth silent failure when both auth mixins are present
Apr 4, 2026
Contributor
There was a problem hiding this comment.
Pull request overview
Fixes a silent authentication failure in the Kraken integration when both oauth_mixin.py and kraken_auth_mixin.py ship together, ensuring auth_method="email" / "api_key" obtains a JWT instead of repeatedly proceeding with access_token=None.
Changes:
apps/predbat/kraken.py: ImportKrakenAuthMixinindependently of_AUTH_BASEselection and use a module-level availability check for local auth.apps/predbat/kraken.py: Foremail/api_keyauth, initialize viaKrakenAuthMixinand bind its token-related methods onto the instance to overrideOAuthMixinbehavior.apps/predbat/tests/test_kraken.py: Add regression tests confirmingemail/api_keyactually obtain and setaccess_token, and that OAuth mode remains unaffected.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| apps/predbat/kraken.py | Ensures local Kraken auth works even when OAuthMixin is the selected base mixin by binding KrakenAuthMixin token methods per-instance. |
| apps/predbat/tests/test_kraken.py | Adds regression coverage to prevent reintroducing the “True-but-no-token” behavior for local auth while preserving OAuth behavior. |
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.
When both
oauth_mixin.pyandkraken_auth_mixin.pyare present (standard release package),_AUTH_BASE = OAuthMixinis always selected. SinceKrakenAPIonly inheritsOAuthMixin,hasattr(self, "_init_kraken_auth")isFalse, soinitialize()falls through toOAuthMixin._init_oauth()forauth_method="email". That setsaccess_token = None;OAuthMixin.check_and_refresh_oauth_token()then returnsTruefor non-OAuth methods without obtaining a token — producing "Warn: Kraken: No access token for find-tariffs" on every GraphQL call.Changes
kraken.pyKrakenAuthMixinat module level into_KrakenAuthMixinindependently of_AUTH_BASEselectionhasattr(self, "_init_kraken_auth")with_KrakenAuthMixin is not None(module-level check, not class-hierarchy check)auth_method in ("email", "api_key")and_KrakenAuthMixinis available, call_KrakenAuthMixin._init_kraken_auth(self, ...)directly and bind its token methods (check_and_refresh_oauth_token,handle_oauth_401,_kraken_token_request) to the instance, overridingOAuthMixinat the instance leveltests/test_kraken.pyaccess_tokenis actually obtained (not justTruereturned)Warning
Firewall rules blocked me from connecting to one or more addresses (expand for details)
I tried to connect to the following addresses, but was blocked by firewall rules:
gitlab.com/usr/lib/git-core/git-remote-https /usr/lib/git-core/git-remote-https origin REDACTED(dns block)https://api.github.com/repos/springfall2008/batpred/contents/apps/predbat/home/REDACTED/work/batpred/batpred/coverage/venv/bin/python3 python3 ../apps/predbat/unit_test.py --test kraken --test kraken_auth(http block)If you need me to access, download, or install something from one of these locations, you can either: