pip install weather
import weather
forecast=weather.forecast()
forecast.today['6:00'].temp # Get temperature in current location at 6.00
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
weather
supports multiple weather sources:
- [Yr.No] (https://yr.no)
- [Google] (https://google.com)
- [7timer!] (https://7timer.info)
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')
Instance of Wind()
Properties:
Integer
Speed in m/s
Instance of Direction() Properties:
Integer Angle in degrees
String Angle in compass point ( 'N','NE','E','SE','S','SW','W', or 'NW' )
Float/Integer
Temperature in °C or °F (not °K)(default °C, see 'Changing units')
Float/Integer
Humidity in %.
Float/Integer
Precipitation amount in milimeters
weather.forecast('New york', unit=weather.CELSIUS)#or weather.FAHRENHEIT
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.
weather
is licensed under GPL license