Skip to main content

Access weather forecast

Project description

weather - Access weather forecast

Installation

pip install weather

Usage

import weather
forecast=weather.forecast()
forecast.today['6:00'].temp # Get temperature in current location at 6.00

Different places

If you want to get forecast from different place, pass forecast an argument.

import weather
forecast=weather.forecast('New York')
forecast.tommorow['11:00'].precip # Get precipitation in New York at 11.00

Different sources

weather supports multiple weather sources:

  1. [Yr.No] (https://yr.no)
  2. [Google] (https://google.com)
  3. [7timer!] (https://7timer.info) If you want to get weather from different source, pass forecast argument called source.
weather.forecast(source='yrno')
weather.forecast(source='google')
weather.forecast(source='7timer')

Weather properties

1. wind

Instance of Wind() Properties:

1. speed
   Integer
   Speed in m/s
2. direction

Instance of Direction() Properties:

1. angle

Integer Angle in degrees

2. direction

String Angle in compass point ( 'N','NE','E','SE','S','SW','W', or 'NW' )

2. temp

  Float/Integer
  Temperature in °C or °F (not °K)(default °C, see 'Changing units')

3. humid(yr.no only, other services will return None)

  Float/Integer
  Humidity in %.

4. precip(7timer will return bool)

  Float/Integer
  Precipitation amount in milimeters

Changing units

weather.forecast('New york', unit=weather.CELSIUS)#or weather.FAHRENHEIT

CLI

Just run weather: [user@localhost ~] weather If you want to get all avaliable switches, use weather -h:

usage: weather [-h] [--city CITY] [--country COUNTRY] [-d] [-s SERVICE]

Python app for getting weather forecast

optional arguments:
  -h, --help            show this help message and exit
  --city CITY           City for forecast (if not passed, using current location)
  --country COUNTRY     Country for forecast (see above)
  -d, --debug           Debug
  -s SERVICE, --service SERVICE
                        Service to use (e.g. "yrno","7timer","google"). Implied with "average"(try to optimise the service)

That says basically enough to use it.

License

weather is licensed under GPL license

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

weather2-1.3.2.tar.gz (32.4 kB view details)

Uploaded Source

File details

Details for the file weather2-1.3.2.tar.gz.

File metadata

  • Download URL: weather2-1.3.2.tar.gz
  • Upload date:
  • Size: 32.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.6.1 pkginfo/1.7.0 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.61.1 CPython/3.9.6

File hashes

Hashes for weather2-1.3.2.tar.gz
Algorithm Hash digest
SHA256 26ecdc64c278e29c2cc0d6d5a5851c4340571d41ebecf499a16a4dfc31d17a1a
MD5 751b03a32e308ba4aeaa87a07f431cda
BLAKE2b-256 27de2298fb5c02f36352175ee049f5f2b73fa72768a941db745965a1db5d6de7

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