Repository navigation
Widgets (#317) PR 6: Open-Meteo weather provider - #658
Merged
Merged
Conversation
daoudclarke
force-pushed
the
claude/issue-317-pr6
branch
from
November 13, 2026 18:31
f313296 to
7bb5078
Compare
daoudclarke
force-pushed
the
claude/issue-317-pr6
branch
from
November 13, 2026 22:07
7bb5078 to
f16b2bd
Compare
Two specs (weather, forecast) on Open-Meteo, current conditions plus three days with WMO codes in words, cached for 30 minutes. index_widgets --places reads GeoNames cities15000 and countryInfo.txt (downloaded, never committed) and writes one document per place per spec, synced under the same keys as the other widgets so stale places are removed. The finder treats specs on one API as one widget. No functional changes to the crawler. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DTbu4ortjqC5Z7Kw9377LE
GeoNames names it "New York City", so "weather in new york" showed York, UK. A trailing "city" is dropped from names of three or more words. No functional changes to the crawler. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DTbu4ortjqC5Z7Kw9377LE
A plain run used to remove every indexed place, because it synced the place specs with no places. It now syncs only the specs without page-URL placeholders. Place keys are kept in widget-place-keys.json; --places syncs the places again and --no-places removes them all. No functional changes to the crawler. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DTbu4ortjqC5Z7Kw9377LE
daoudclarke
force-pushed
the
claude/issue-317-pr6
branch
from
November 13, 2026 22:40
f16b2bd to
bc636b0
Compare
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
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.
What
open-meteo-weather(triggerweather) andopen-meteo-weather-forecast(triggerforecast). Each shows current conditions plus the next 3 days (display: forecast), cached 30 minutes. The API URL asks forforecast_days=4, and the outputs are bounded to now plus days 1-3. Source credit is "Open-Meteo.com" (CC BY 4.0), linked viashare_url.OutputField.transform: "wmo_code"turns WMO weather codes into words (mwmbl/widgets/wmo.py). An unknown code is dropped.mwmbl/widgets/places.pyreads GeoNamescities15000.txtandcountryInfo.txt. They are downloaded by the operator and never committed.index_widgets --places CITIES COUNTRY_INFOwrites one document per place per place-based spec, most populous first.https://open-meteo.com/en/docs?latitude=..&longitude=..&ref=mwmbl(&ref=mwmbl-forecastfor the forecast spec). Therefkeeps them distinct from a real crawled open-meteo.com URL.sync_widgetstakes the places. Place documents sync and purge under the samewidget-keys.jsonkeys as the other widgets. Titles and URLs must be unique, and robots is checked once per spec rather than once per document.WidgetFindertreats specs that share an API URL as one widget, so "york weather forecast" shows one widget. Ties go to the weather spec.site_allows_mwmblfills the page URL placeholders before checking robots.test/test_widgets_tannerd.pywas failingmake check, so I removed it.Needs a decision: Open-Meteo API robots.txt
https://api.open-meteo.com/robots.txtisUser-agent: */Disallow: /.open-meteo.comitself allows everything. If the API robots check stayed, the widget would never be indexed and the endpoint would always return 404. I addedWidgetSpec.check_api_robots(defaulttrue) and set it tofalseonly for these two specs, on the reasoning that the documented public API is meant for programmatic use and the robots file is aimed at crawlers. The spec's page (open-meteo.com) is still robots-checked. Please confirm you are happy with this, or drop the spec if not.Open-Meteo's free API is for non-commercial use with attribution, which fits a non-profit. Its free limits are 600 calls/min and 10,000/day per IP, and the 30-minute cache plus the per-spec rate limit keep us well inside them.
Known limitation
Place tokens come from GeoNames' ASCII name, so "zurich weather" works but "zürich weather" does not.
Verification
make checkpasses (ty is non-gating).test/test_widgets_weather.py(new) covers the specs, place reading and title disambiguation, and WMO mapping. It also covers the 3-day bound, lookup for weather, forecast and combined queries, sync purging of removed or blocked places, and the command with its robots calls.Part of #317. Stacked on PR 5 (
claude/issue-317-pr5).Generated by Claude Code