Skip to main content

OpenWeatherMap CLI client

Project description

owm

English | Español

GitHub


English

A command-line client for OpenWeatherMap that lets you query current weather and geocoding data directly from the terminal.

Installation

APT (Debian/Ubuntu)

# 1. Add the APT repository
echo "deb https://pablinet.github.io/apt ./" > /etc/apt/sources.list.d/pablinet.list

# 2. Add the APT key
# With curl:
curl -fsSL https://pablinet.github.io/apt/pablinet.gpg -o /etc/apt/trusted.gpg.d/pablinet.gpg
# Or with wget:
wget -O /etc/apt/trusted.gpg.d/pablinet.gpg https://pablinet.github.io/apt/pablinet.gpg

# 3. Update and install
apt update && apt install owm

pip

pip install owm

Requirements

Usage

owm [options]
# or
python3 -m owm [options]

Modes

Weather mode — requires --geo or --lat/--lon, plus at least one output flag:

owm --geo=-34.61,-58.38 --key=YOUR_KEY -t
owm --lat=-34.61 --lon=-58.38 --key=YOUR_KEY -t --description

# With imperial units
owm --geo=40.71,-74.01 --key=YOUR_KEY --units=imperial -t --wind

# Using python3 -m
python3 -m owm --geo=-34.61,-58.38 --key=YOUR_KEY -t --humidity

Geocoding mode — search cities by name:

owm --city=Madrid --key=YOUR_KEY
owm --city="Buenos Aires" --key=YOUR_KEY

# Using python3 -m
python3 -m owm --city=Paris --key=YOUR_KEY

All flags

Configuration

Flag Description
--key KEY OpenWeatherMap API key (or OWM_API_KEY env var)
--city CITY Search city by name (geocoding mode)
--geo LAT,LON Coordinates as LAT,LON (or OWM_GEO env var)
--lat LAT Latitude (use with --lon, or OWM_GEO env var)
--lon LON Longitude (use with --lat, or OWM_GEO env var)
--units UNITS Unit system: metric (default) or imperial (or OWM_UNITS env var)
--lang LANG Language for weather description (or LANG env var, default: en)
--time SECONDS Cache validity in seconds (or OWM_SECONDS env var, default: 300)
--space SPACE Separator between output fields (default: space)
-h, --help Show help and exit
-v, --version Show version and exit

Output (weather mode only)

Flag Description
--temp Temperature
--feels-like Feels like temperature
--temp-feels-like Temperature or feels-like, alternating every 5 seconds
--description Weather description
--humidity Relative humidity
--pressure Atmospheric pressure
--wind Wind speed and direction
--icon Weather icon code
--visibility Visibility
--sunrise Sunrise time
--sunset Sunset time
--name City name
--id OWM city ID

Environment variables

Variable Equivalent flag
OWM_API_KEY --key
OWM_GEO --geo / --lat + --lon
OWM_UNITS --units
OWM_SECONDS --time
LANG --lang

Example:

export OWM_API_KEY=your_api_key
export OWM_GEO=-34.61,-58.38
export OWM_UNITS=metric

owm --temp --description
owm --temp-feels-like --humidity --space=" | "
python3 -m owm --wind --pressure --units=imperial

Examples

# Temperature and description, pipe-separated
owm --geo=-34.61,-58.38 --key=YOUR_KEY --description --temp --space=" | "
# 18°C | scattered clouds

# Metric vs imperial
owm --geo=40.71,-74.01 --key=YOUR_KEY --temp --units=metric
# 22°C
owm --geo=40.71,-74.01 --key=YOUR_KEY --temp --units=imperial
# 71.6°F

# Full weather report
owm --lat=48.85 --lon=2.35 --key=YOUR_KEY --temp --feels-like --humidity --wind --pressure
python3 -m owm --lat=48.85 --lon=2.35 --key=YOUR_KEY --temp --feels-like --humidity --wind --pressure

# Geocoding
owm --city=Tokyo --key=YOUR_KEY
python3 -m owm --city="New York" --key=YOUR_KEY

# Sunrise and sunset
owm --geo=-34.61,-58.38 --key=YOUR_KEY --sunrise --sunset --space=" / "

Changes in 0.4.0

The flags -d, -i, -l, -n, -p, -t and -w have been removed. The flags -h and -v have been replaced by --help and --version respectively starting from version 0.4.0.


Español

Un cliente de línea de comandos para OpenWeatherMap que permite consultar el clima actual y datos de geolocalización directamente desde la terminal.

Instalación

APT (Debian/Ubuntu)

# 1. Agregar el repositorio APT
echo "deb https://pablinet.github.io/apt ./" > /etc/apt/sources.list.d/pablinet.list

# 2. Agregar la clave APT
# Con curl:
curl -fsSL https://pablinet.github.io/apt/pablinet.gpg -o /etc/apt/trusted.gpg.d/pablinet.gpg
# O con wget:
wget -O /etc/apt/trusted.gpg.d/pablinet.gpg https://pablinet.github.io/apt/pablinet.gpg

# 3. Actualizar e instalar
apt update && apt install owm

pip

pip install owm

Requisitos

Uso

owm [opciones]
# o
python3 -m owm [opciones]

Modos

Modo clima — requiere --geo o --lat/--lon, más al menos un flag de salida:

owm --geo=-34.61,-58.38 --key=TU_KEY -t
owm --lat=-34.61 --lon=-58.38 --key=TU_KEY -t --description

# Con unidades imperiales
owm --geo=40.71,-74.01 --key=TU_KEY --units=imperial -t --wind

# Usando python3 -m
python3 -m owm --geo=-34.61,-58.38 --key=TU_KEY -t --humidity

Modo geolocalización — buscar ciudades por nombre:

owm --city=Madrid --key=TU_KEY
owm --city="Buenos Aires" --key=TU_KEY

# Usando python3 -m
python3 -m owm --city=Paris --key=TU_KEY

Todos los flags

Configuración

Flag Descripción
--key KEY API key de OpenWeatherMap (o variable OWM_API_KEY)
--city CITY Buscar ciudad por nombre (modo geolocalización)
--geo LAT,LON Coordenadas en formato LAT,LON (o variable OWM_GEO)
--lat LAT Latitud (usar junto con --lon, o variable OWM_GEO)
--lon LON Longitud (usar junto con --lat, o variable OWM_GEO)
--units UNITS Sistema de unidades: metric (por defecto) o imperial (o variable OWM_UNITS)
--lang LANG Idioma de la descripción del clima (o variable LANG, por defecto: en)
--time SECONDS Segundos de validez del caché (o variable OWM_SECONDS, por defecto: 300)
--space SPACE Separador entre campos de salida (por defecto: espacio)
-h, --help Mostrar ayuda y salir
-v, --version Mostrar versión y salir

Salidas (solo modo clima)

Flag Descripción
--temp Temperatura
--feels-like Sensación térmica
--temp-feels-like Temperatura o sensación térmica, alternando cada 5 segundos
--description Descripción del clima
--humidity Humedad relativa
--pressure Presión atmosférica
--wind Velocidad y dirección del viento
--icon Código de ícono del clima
--visibility Visibilidad
--sunrise Hora de salida del sol
--sunset Hora de puesta del sol
--name Nombre de la ciudad
--id ID de la ciudad en OWM

Variables de entorno

Variable Flag equivalente
OWM_API_KEY --key
OWM_GEO --geo / --lat + --lon
OWM_UNITS --units
OWM_SECONDS --time
LANG --lang

Ejemplo:

export OWM_API_KEY=tu_api_key
export OWM_GEO=-34.61,-58.38
export OWM_UNITS=metric

owm --temp --description
owm --temp-feels-like --humidity --space=" | "
python3 -m owm --wind --pressure --units=imperial

Ejemplos

# Temperatura y descripción separadas por pipe
owm --geo=-34.61,-58.38 --key=TU_KEY --description --temp --space=" | "
# 18°C | nubes dispersas

# Métrico vs imperial
owm --geo=40.71,-74.01 --key=TU_KEY --temp --units=metric
# 22°C
owm --geo=40.71,-74.01 --key=TU_KEY --temp --units=imperial
# 71.6°F

# Reporte completo
owm --lat=48.85 --lon=2.35 --key=TU_KEY --temp --feels-like --humidity --wind --pressure
python3 -m owm --lat=48.85 --lon=2.35 --key=TU_KEY --temp --feels-like --humidity --wind --pressure

# Geolocalización
owm --city=Tokio --key=TU_KEY
python3 -m owm --city="Nueva York" --key=TU_KEY

# Salida y puesta del sol
owm --geo=-34.61,-58.38 --key=TU_KEY --sunrise --sunset --space=" / "

Cambios en la versión 0.4.0

Los flags -d, -i -l, -n, -p, -t y -w fueron eliminados. Los flags -h y -v fueron reemplazados por --help y --version respectivamente a partir de la versión 0.4.0.

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

owm-0.5.1.tar.gz (29.2 kB view details)

Uploaded Source

Built Distribution

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

owm-0.5.1-py3-none-any.whl (29.9 kB view details)

Uploaded Python 3

File details

Details for the file owm-0.5.1.tar.gz.

File metadata

  • Download URL: owm-0.5.1.tar.gz
  • Upload date:
  • Size: 29.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.5

File hashes

Hashes for owm-0.5.1.tar.gz
Algorithm Hash digest
SHA256 7b3709434aa04c83e3184aa731843d315e7958248aec2abfe9757e1e27602c7b
MD5 c42386e57f040414d4765f1dba4f863f
BLAKE2b-256 e6d98d91c0e35694801dc7e8673a2647dbdd2dacd5a6cd58636356a34b67a99c

See more details on using hashes here.

File details

Details for the file owm-0.5.1-py3-none-any.whl.

File metadata

  • Download URL: owm-0.5.1-py3-none-any.whl
  • Upload date:
  • Size: 29.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.5

File hashes

Hashes for owm-0.5.1-py3-none-any.whl
Algorithm Hash digest
SHA256 8cbdc718f9dd7c8eb4e0afa4342c1b76718da08aac73d65e8e96fc202557213f
MD5 63cc447adb2b01521fb6a7693c3c5884
BLAKE2b-256 0577b48b8cc9d04d7842151477c2150192fedaeb57370be4dac26f363a7ed22e

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