Skip to main content

Lightweight client for fetching current weather from OpenWeatherMap.

Project description

skyfall

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

Installation

pip install skyfall

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 SkyFall instance.

Usage

from skyfall import SkyFall

client = SkyFall(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.

SkyFall(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 SkyFallError. 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 skyfall import SkyFall; print(SkyFall(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 Distribution

sky_fall-0.2.0.tar.gz (5.1 kB view details)

Uploaded Source

Built Distribution

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

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

Uploaded Python 3

File details

Details for the file sky_fall-0.2.0.tar.gz.

File metadata

  • Download URL: sky_fall-0.2.0.tar.gz
  • Upload date:
  • Size: 5.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.5

File hashes

Hashes for sky_fall-0.2.0.tar.gz
Algorithm Hash digest
SHA256 02845298a2791423c614164e4939fac2cbac62151e222f238a404cc7fbe7b6c7
MD5 a2cd9673e34b349896f0df8cd0fa1a98
BLAKE2b-256 ceda04fc6347306d3aa631760cd4c4d0bde624cb186901bad16905acd90da55c

See more details on using hashes here.

File details

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

File metadata

  • Download URL: sky_fall-0.2.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.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 4293d14e67e02553da05b53db53e25754e2c8876e3589cd07c0298d23bffd14f
MD5 b0c2daeb1b52bd6c4f7ee75dacdcc71d
BLAKE2b-256 c9d903e7d71844d9d26552b2b58245278d6eba476976c76f4aad413627723a9d

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