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
requestslibrary, which is installed automatically.
Getting an API key
- Sign up for a free OpenWeatherMap account.
- Generate an API key from the dashboard.
- Provide that key when creating a
SkyFetchinstance.
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
- Update the version in
pyproject.toml. - Build artifacts:
python -m build - Upload with
twine upload dist/*
License
MIT License. See LICENSE for details.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d5177ea873b57b2a043fb8ff74747007e5987847f28e62d90bda45b80c168117
|
|
| MD5 |
3d99133b30862258400251406d169844
|
|
| BLAKE2b-256 |
52f6f6305a18add4e0640fb0f51784db9a026cc63eb0235a6346f903c7627124
|