Skip to main content

Python SDK for Meteoflow Weather API

Project description

Meteoflow Python SDK

Python SDK for Meteoflow Weather API.

Install

pip install meteoflow

Quick Start

from meteoflow import WeatherClient, LocationSlug, LocationCoords, LocationIP

client = WeatherClient("TOKEN")

# Current weather by slug
current = client.current(LocationSlug("united-kingdom-london"))

# Current weather by coords
current = client.current(LocationCoords(51.5072, -0.1275))

# Current weather by IP
current = client.current(LocationIP("8.8.8.8"))

Forecasts

from meteoflow import WeatherClient, LocationIP, ForecastOptions

client = WeatherClient("TOKEN")

# Hourly forecast by IP
options = ForecastOptions(days=1, units="metric", lang="en")
forecast = client.forecast_hourly(LocationIP("8.8.8.8"), options)

# 3-hour forecast by IP
options = ForecastOptions(days=2, units="metric", lang="en")
forecast = client.forecast_3hourly(LocationIP("8.8.8.8"), options)

# Daily forecast by IP
options = ForecastOptions(days=5, units="metric", lang="en")
forecast = client.forecast_daily(LocationIP("8.8.8.8"), options)

Air Quality

from meteoflow import AirQualityClient, LocationCoords, ForecastOptions

client = AirQualityClient("TOKEN")

air = client.by_days(LocationCoords(51.5072, -0.1275), ForecastOptions(days=3))

Geomagnetic

from meteoflow import GeomagneticClient, LocationSlug

client = GeomagneticClient("TOKEN")

geo = client.by_days(LocationSlug("united-kingdom-london"))

Geography Search → Weather

from meteoflow import GeographyClient, WeatherClient, LocationSlug

geo = GeographyClient("TOKEN")
weather = WeatherClient("TOKEN")

results = geo.search("London", limit=1)
slug = results["items"][0]["slug"]

current = weather.current(LocationSlug(slug))

Auth: Header vs Query

from meteoflow import WeatherClient, LocationSlug

# Default: X-token header
client = WeatherClient("TOKEN")
current = client.current(LocationSlug("united-kingdom-london"))

# Query auth: ?key=TOKEN
client_q = WeatherClient("TOKEN", auth_in_query=True)
current_q = client_q.current(LocationSlug("united-kingdom-london"))

Notes

  • Supported Python versions: 3.4+
  • Sync only in core package
  • Returns parsed JSON as dict

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

meteoflow-1.0.0.tar.gz (8.2 kB view details)

Uploaded Source

Built Distribution

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

meteoflow-1.0.0-py3-none-any.whl (9.1 kB view details)

Uploaded Python 3

File details

Details for the file meteoflow-1.0.0.tar.gz.

File metadata

  • Download URL: meteoflow-1.0.0.tar.gz
  • Upload date:
  • Size: 8.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.12

File hashes

Hashes for meteoflow-1.0.0.tar.gz
Algorithm Hash digest
SHA256 c6b154dbbe37bc2bb2d7ed109f287a6e79783d90b2ef9e73884a66ea6350306c
MD5 625735c3fc70f5964d3ccee5c8d138b2
BLAKE2b-256 260b7611812315fd6b6ff16ee3ac04afbd6e8adb17bbb2a0a9c9a06690f01b06

See more details on using hashes here.

File details

Details for the file meteoflow-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: meteoflow-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 9.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.12

File hashes

Hashes for meteoflow-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 da92909b019edf686ea4cb77db3cc36a5b9ff7e023ce59019a8b4eeede576193
MD5 2ec815bb7d52d5561d5365786337ae79
BLAKE2b-256 9470359a3a42b52010f341c516419996cf32de75e2a541680b454d5f891b5b14

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