Skip to main content

Lightweight client for fetching current weather from OpenWeatherMap.

Project description

sky_fetch

Minimal Python client for the OpenWeatherMap current weather endpoint. It keeps the public interface intentionally tiny—instantiate SkyFetch with your API key, then call .weather("City Name") for a structured weather snapshot.

Installation

pip install sky_fetch

Note: The package requires Python 3.8 or newer and the requests library, which is installed automatically.

Getting an API key

  1. Sign up for a free OpenWeatherMap account.
  2. Generate an API key from the dashboard.
  3. Provide that key when creating a SkyFetch instance.

Usage

from sky_fetch import SkyFetch

client = SkyFetch(api_key="your-openweather-api-key")

report = client.weather("Berlin")

print(report.city)            # "Berlin"
print(report.temperature_c)   # e.g. 18.4
print(report.description)     # e.g. "broken clouds"

By default results use metric units. Pass units="imperial" or units="standard" when instantiating the client to change that. Set a custom timeout via the timeout keyword if desired.

SkyFetch(api_key="...", units="imperial", timeout=5)

Returned data

.weather(...) returns a WeatherReport dataclass containing:

  • city: Name OpenWeatherMap associates with the coordinates.
  • description: Human-readable summary of the current conditions.
  • temperature_c / feels_like_c: Temperatures in the requested unit system (suffix kept for clarity).
  • humidity: Relative humidity percentage.
  • raw: The complete JSON payload from OpenWeatherMap for advanced use cases.

Access the raw payload if you need additional fields not surfaced on the dataclass.

Error handling

Network or API issues raise SkyFetchError. Double-check your API key, usage limits, and spelling of the city name if you encounter errors. Invalid arguments raise ValueError.

Local development

python -m venv .venv
source .venv/bin/activate  # or .venv\Scripts\activate on Windows
pip install -e .[dev]

Run a quick manual check:

python -c "from sky_fetch import SkyFetch; print(SkyFetch(api_key='YOUR_KEY').weather('Tokyo'))"

Publishing

  1. Update the version in pyproject.toml.
  2. Build artifacts: python -m build
  3. Upload with twine upload dist/*

License

MIT License. See LICENSE for details.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

sky_fall-0.1.0-py3-none-any.whl (5.3 kB view details)

Uploaded Python 3

File details

Details for the file sky_fall-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: sky_fall-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 5.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.5

File hashes

Hashes for sky_fall-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d5177ea873b57b2a043fb8ff74747007e5987847f28e62d90bda45b80c168117
MD5 3d99133b30862258400251406d169844
BLAKE2b-256 52f6f6305a18add4e0640fb0f51784db9a026cc63eb0235a6346f903c7627124

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page