[FIX] currency_rate_update_xe: add User-Agent header to fix xe.com 403 blocking#234
Open
mohamedhagag wants to merge 1 commit into
Open
[FIX] currency_rate_update_xe: add User-Agent header to fix xe.com 403 blocking#234mohamedhagag wants to merge 1 commit into
mohamedhagag wants to merge 1 commit into
Conversation
xe.com started blocking requests without a User-Agent header around May 2025, returning HTTP 403 which silently produced empty rate results. Add a browser User-Agent, call raise_for_status() so errors surface as a proper UserError, and switch the base URL to HTTPS. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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.
Summary
User-Agentheader around May 2025, returning HTTP 403. The code sent requests with Python's defaultpython-requests/x.x.xUA which is trivially bot-filtered._parse_datamethod silently returned an empty dict on a 403 page (0 rows found), so no rates were written and no error was raised — making the breakage invisible in logs.base_urlfromhttp://tohttps://to avoid an unnecessary redirect on every call.Changes
User-Agentbrowser header to_request_dataresponse.raise_for_status()and handleHTTPErrorseparately so HTTP-level failures surface as a meaningfulUserErrorin Odoo instead of silently producing empty resultshttps://for the base URLTest plan
_get_latest_rateand_get_historical_ratepaths🤖 Generated with Claude Code