Skip to main content

A free and asynchronous weather API wrapper made in Python, for Python.

Project description

python-weather pypi pypi downloads codacy-badge codecov-badge ko-fi

A free and asynchronous weather Python API wrapper made in Python, for Python.

Getting started

Run the following command in your terminal:

pip install python-weather

Example

For more information, please read the documentation.

# Import the module.
import python_weather

import asyncio


async def main() -> None:
  
  # Declare the client. The measuring unit used defaults to the metric system (celcius, km/h, etc.)
  async with python_weather.Client(unit=python_weather.IMPERIAL) as client:
    
    # Fetch a weather forecast from a city.
    weather = await client.get('New York')
    
    # Fetch the temperature for today.
    print(weather.temperature)
    
    # Fetch weather forecast for upcoming days.
    for daily in weather:
      print(daily)
    
      # Each daily forecast has their own hourly forecasts.
      for hourly in daily:
        print(f' --> {hourly!r}')

if __name__ == '__main__':
  asyncio.run(main())

Data source

This library depends on wttr.in, which uses data from the World Weather Online API.

Donations

If you want to support this project, consider donating! ❤

ko-fi

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

python_weather-2.2.1.tar.gz (12.9 kB view details)

Uploaded Source

Built Distribution

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

python_weather-2.2.1-py3-none-any.whl (13.9 kB view details)

Uploaded Python 3

File details

Details for the file python_weather-2.2.1.tar.gz.

File metadata

  • Download URL: python_weather-2.2.1.tar.gz
  • Upload date:
  • Size: 12.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for python_weather-2.2.1.tar.gz
Algorithm Hash digest
SHA256 528725c2110bca4f53c9205d119a95a40c259dd6f9604060766dc2f6927c76fd
MD5 436bd973024717bc7decd7ee825b9fd8
BLAKE2b-256 de6ad21f3c4d86984d5a740a9f850dd867fc19d5e0030af8583ece075d7935d9

See more details on using hashes here.

Provenance

The following attestation bundles were made for python_weather-2.2.1.tar.gz:

Publisher: publish.yml on null8626/python-weather

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file python_weather-2.2.1-py3-none-any.whl.

File metadata

  • Download URL: python_weather-2.2.1-py3-none-any.whl
  • Upload date:
  • Size: 13.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for python_weather-2.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 600a4487327245ce91468709d8ab94c9130ccae340fc61ed5e1994260927742a
MD5 2f9ec1a22552c0a43f48f06e10ebc0fe
BLAKE2b-256 34e70db698ba1d8564a71576efb7223bd9c0be4f0b4ae192164ab1aea7507b72

See more details on using hashes here.

Provenance

The following attestation bundles were made for python_weather-2.2.1-py3-none-any.whl:

Publisher: publish.yml on null8626/python-weather

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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