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.2.tar.gz (13.1 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.2-py3-none-any.whl (14.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: python_weather-2.2.2.tar.gz
  • Upload date:
  • Size: 13.1 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.2.tar.gz
Algorithm Hash digest
SHA256 856a6f7d4767e840c35ce13d4e83d6fbe6894f91164ea8bbc67e77f565b02f39
MD5 4dc7ad82490ae284bd3ce1486f6fcc05
BLAKE2b-256 4ec578a108cba15f21015f3745bb6f8f17a5d0f2afebc1328a3f6b49aa8addb1

See more details on using hashes here.

Provenance

The following attestation bundles were made for python_weather-2.2.2.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.2-py3-none-any.whl.

File metadata

  • Download URL: python_weather-2.2.2-py3-none-any.whl
  • Upload date:
  • Size: 14.0 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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 f96488aa75e272f2c299146a53fe2af437be7662d792c74a49d81f75940a25e8
MD5 5a0b5632857e03f0841f86cd3aae329f
BLAKE2b-256 ba8833c52d8288e606334431986dcd7268884fec5d8147177086853d442fa67d

See more details on using hashes here.

Provenance

The following attestation bundles were made for python_weather-2.2.2-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