Skip to main content

A Python wrapper for the OpenWeatherMap API

Project description

Weather API Wrapper

License GitHub release (latest by date) GitHub last commit GitHub issues GitHub pull requests

A Python wrapper for the OpenWeatherMap API, enabling easy access to weather data for any location.

Installation

You can install the Weather API Wrapper using pip:

pip install weather-api-wrapper

Features

  • Provides a Python interface to interact with the OpenWeatherMap API.
  • Retrieve current weather, weather forecast, historical weather data, air pollution data, UV index data, and weather alerts for a specified location.
  • Command-line interface (CLI) for easy access to weather data.

Usage

from weather_api_wrapper import WeatherClient

# Initialize the WeatherClient with your OpenWeatherMap API key
client = WeatherClient(api_key='your_api_key')

# Get current weather for a specific city
current_weather = client.get_current_weather(city='London')

# Get weather forecast for a specific city
forecast = client.get_weather_forecast(city='New York')

# Get historical weather data for a specific city and date range
historical_data = client.get_historical_weather(city={'lat': 51.51, 'lon': -0.13}, start_date='2024-04-01', end_date='2024-04-07')

# Get air pollution data for a specific city
air_pollution = client.get_air_pollution(city={'lat': 51.51, 'lon': -0.13})

# Get UV index data for a specific city
uv_index = client.get_uv_index(city={'lat': 51.51, 'lon': -0.13})

# Get weather alerts for a specific city
weather_alerts = client.get_weather_alerts(city='New York')

Replace your_api_key with your actual OpenWeatherMap API key.

Command Line Interface (CLI)

You can also use the command-line interface to retrieve weather data:

weather-cli --api-key your_api_key London

Replace 'your_api_key' with your actual OpenWeatherMap API key and 'London' with the city for which you want to retrieve weather data.

The CLI supports the following commands:

  • weather-cli: Fetches current weather data for a specified city.
  • weather-cli --api-key your_api_key --forecast London: Fetches weather forecast data for a specified city.
  • weather-cli --api-key your_api_key --historical London --start-date 2024-04-01 --end-date 2024-04-07: Fetches historical weather data for a specified city and date range.
  • weather-cli --api-key your_api_key --pollution London: Fetches air pollution data for a specified city.
  • weather-cli --api-key your_api_key --uv London: Fetches UV index data for a specified city.
  • weather-cli --api-key your_api_key --alerts London: Fetches weather alerts for a specified city.

Documentation

For detailed usage instructions and API documentation, please refer to the documentation.

Contributing

Contributions are welcome! If you have any suggestions, feature requests, or bug reports, please open an issue on GitHub. See the Code of conduct for more details.

License

This project is licensed under the MIT License. See the LICENSE file 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

weather_api_wrapper-0.1.6.tar.gz (6.6 kB view details)

Uploaded Source

Built Distribution

weather_api_wrapper-0.1.6-py3-none-any.whl (7.3 kB view details)

Uploaded Python 3

File details

Details for the file weather_api_wrapper-0.1.6.tar.gz.

File metadata

  • Download URL: weather_api_wrapper-0.1.6.tar.gz
  • Upload date:
  • Size: 6.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.12.2

File hashes

Hashes for weather_api_wrapper-0.1.6.tar.gz
Algorithm Hash digest
SHA256 000ce33bc49f1265a5d48a7afc6bd3a12fd96d04756166ad011c15f6267f80fa
MD5 4407a3958847d508e41bb8e0c173ff94
BLAKE2b-256 ce2ec7a7fc5829acf78cd0ed6013350e2a67397878de8d7f55ec8aa0acbc60f4

See more details on using hashes here.

File details

Details for the file weather_api_wrapper-0.1.6-py3-none-any.whl.

File metadata

File hashes

Hashes for weather_api_wrapper-0.1.6-py3-none-any.whl
Algorithm Hash digest
SHA256 79e43156d0f766917c02324e0779973f03c8284073922655ae88febd81eff88d
MD5 8d8f11bf5d9868355ee9e4a50d4ff763
BLAKE2b-256 082dfd7f4ef4d27549958bff39f1e649b1948e48acfefaf636894eb6bd0f5140

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page