# Meteoflow Python SDK

Python SDK for Meteoflow Weather API.

## Install

```bash
pip install meteoflow
```

## Quick Start

```python
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

```python
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

```python
from meteoflow import AirQualityClient, LocationCoords, ForecastOptions

client = AirQualityClient("TOKEN")

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

## Geomagnetic

```python
from meteoflow import GeomagneticClient, LocationSlug

client = GeomagneticClient("TOKEN")

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

## Geography Search → Weather

```python
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

```python
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`
