Repository navigation
Fetch feeds through an optional HTTP or SOCKS proxy - #175
Merged
Merged
Conversation
Feeds that are blocked on the user's network or in their country could not be read at all: the only way to route requests through a proxy was the HTTP(S)_PROXY environment variables, which are hard to set on Home Assistant OS and apply to every feed. Each feed now has an optional proxy URL (http, https, socks4, socks4a, socks5 or socks5h; PySocks is added for the socks schemes). It is used for the sensor's polls and for the validation fetch during setup and reconfigure, and is available in the setup and options forms and in YAML. Malformed URLs are rejected on their field (UI) or by config validation (YAML). A password in the proxy URL is masked in the reader's repr and in fetch error messages. file:// feeds ignore the proxy, and an empty value keeps the previous behavior, environment variables included. Closes #27 Co-Authored-By: Claude Opus 5.5 <[email protected]>
The pre-commit ruff hook in CI reformats the old signature and then flags ANN401 on **overrides. Co-Authored-By: Claude Opus 5.5 <[email protected]>
mypy in CI types server_address as str | bytes, so formatting the host tripped str-bytes-safe. The test servers always bind to 127.0.0.1. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This was referenced Nov 16, 2026
Closed
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.
Closes #27
Why
Some feeds are blocked on the user's network or in their country. Until now the only way to route feed requests through a proxy was the
HTTP_PROXY/HTTPS_PROXY/ALL_PROXYenvironment variables, which are awkward to set on Home Assistant OS and apply to every feed at once.What changed
proxyoption (setup form, options form and YAML). Supported schemes:http,https,socks4,socks4a,socks5,socks5h. Empty means no proxy, so existing feeds behave exactly as before, environment variables included.fetch_feedpasses the proxy torequestsfor both http and https feeds.file://feeds ignore it.invalid_proxyerror on its field in the UI, before anything is fetched. In YAML it is rejected by config validation.user:pass@hostis masked as***inFeedReader.__repr__and in the coordinator's "Unable to fetch" error.PySocks>=1.7.1inmanifest.jsonandpyproject.toml, needed for thesocks*schemes.strings.jsonand the en/de/el translations.socks5hso the proxy also resolves the host name, which matters when DNS is what blocks the siteNotes for reviewers
tests/test_proxy.pystarts small local HTTP and SOCKS5 proxies on 127.0.0.1, using thesocket_enabledfixture. Their threads are joined at teardown, so HA's lingering-thread check stays happy. The feed URL ishttp://blocked.invalid/rss, which can't resolve locally, so the tests only pass if the request really goes through the proxy. The SOCKS test also checks thatsocks5hsends the host name to the proxy rather than a resolved IP address.test_validate_feed_url_sends_user_agentwas updated for the extraproxyargument.🤖 Generated with Claude Code