Skip to content

Improve weather/air error handling, messaging, and endpoint security#501

Open
vantough wants to merge 7 commits intoTeamUltroid:mainfrom
vantough:main
Open

Improve weather/air error handling, messaging, and endpoint security#501
vantough wants to merge 7 commits intoTeamUltroid:mainfrom
vantough:main

Conversation

@vantough
Copy link
Copy Markdown
Contributor

@vantough vantough commented Apr 5, 2026

Motivation

  • Ensure the OpenWeather air pollution call uses a secure HTTPS endpoint and make geocoding and pollution lookups more resilient to network/timeouts/bad payloads.
  • Provide concise, actionable user-facing messages while preserving developer-visible logs for debugging.
  • Fix visible typos and make response style consistent between the weather and air commands.
  • Address a runtime bug where LOGS was used but not imported and update package version metadata.

Description

  • Switched the air pollution endpoint to https://api.openweathermap.org/data/2.5/air_pollution and added a client timeout to the request in get_air_pollution_data.
  • Reworked get_air_pollution_data to catch timeouts, aiohttp.ClientError, malformed JSON and missing fields, to log details via LOGS.exception(...) and return concise user-facing error messages (function now returns (data, error)).
  • Added a get_geocode_data helper that calls geocode.xyz via async_searcher with defensive handling of timeouts, client errors, invalid JSON and missing keys, returning a structured dict or a short user error.
  • Standardized no-input and failure messages between weather and air, fixed typos such as the Butler/Australia hint and the Nitrogen Monoxide label, and removed inconsistent backticks in user-facing text.
  • Imported LOGS into plugins/weather.py to fix the missing-log bug and bumped pyUltroid/version.py to __version__ = "2026.04.05" and ultroid_version = "2.1.3".

Testing

  • Ran python -m compileall plugins/weather.py pyUltroid/version.py and the files compiled successfully.
  • Identified and fixed a runtime bug (missing LOGS import) during the changes, and verified the updated modules compile without syntax errors.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant