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.0.tar.gz (13.0 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.0-py3-none-any.whl (13.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: python_weather-2.2.0.tar.gz
  • Upload date:
  • Size: 13.0 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.0.tar.gz
Algorithm Hash digest
SHA256 3e7c687158877655b72a319b2b02b2b0db1daf4df643bf3ee2254f5239439b6d
MD5 fe862c195b0bacfd0405103a9e37a5c0
BLAKE2b-256 45fb665bf35acfb57fff0fa3646b8ce84c70dd1396a143aa87aa08bd6495ae43

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: python_weather-2.2.0-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.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f4427796c302d6d33adda474f7b419270f01fb1d1923a3094bcb9c0498e8c87d
MD5 b916d63a37a69a8b35b0c38fbade2e58
BLAKE2b-256 ffb2b6c9731b32fd766eded4fd654d4670101a135b7284e97aeaa35344d6729d

See more details on using hashes here.

Provenance

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