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 two weather sources:
- Yr.No
- 7timer!
If you want to get weather from different source, pass
forecast
argument calledsource
.
weather.forecast(source='yrno')
weather.forecast(source='google')
weather.forecast(source='7timer')
Weather properties
-
Properties:wind
: Instance ofWind()
-
Speed in m/sspeed
: Integer -
Properties:direction
: Instance ofDirection()
-
Angle in degreesangle
: Integer -
Angle in compass point (direction
: String'N'
,'NE'
,'E'
,'SE'
,'S'
,'SW'
,'W'
, or'NW'
)
-
-
-
Temperature in °C or °F (not °K) (default °C, see 'Changing units')temp
: Float/Integer -
Humidity in %.humid
(yr.no
only, other services will returnNone
): Float/Integer -
Precipitation amount in milimetersprecip
(7timer
will returnbool
): Float/Integer
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]
[-u] [-a]
Python app for getting weather forecast
options:
-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 ("yrno" or "7timer"). Implied with
"average"(try to optimise the service)
-u, --ugly Toggle JSON output
-a, --api Just print the data (implies JSON output)
That says basically enough to use it.
License
weather
is licensed under GPL license
Project details
Release history Release notifications | RSS feed
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.6.1.tar.gz
(33.5 kB
view details)
File details
Details for the file weather2-1.6.1.tar.gz
.
File metadata
- Download URL: weather2-1.6.1.tar.gz
- Upload date:
- Size: 33.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | cab4fe2fda69da4b9fc41f3be7e9a766875e055e82685371736053e5809505e4 |
|
MD5 | b3105d4b2bd4aecf0b25d3a9f03ac7d6 |
|
BLAKE2b-256 | a8e3c650241922fc17ac3b67d25470cec96d6dffdd314390236f1abe08672887 |