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
forecastargument calledsource.
weather.forecast(service='yrno')
weather.forecast(service='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.noonly, other services will returnNone): Float/Integer -
Precipitation amount in milimetersprecip(7timerwill 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 MIT license
Metadata
Release files for weather2 1.6.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| weather2-1.6.2.tar.gz | 33.5 kB | Without provenance | Details for weather2-1.6.2.tar.gz |
Release files / weather2-1.6.2.tar.gz
| Download URL | weather2-1.6.2.tar.gz |
|---|---|
| Size | 33.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
cd0c3f6fda824d24a048022ae0ec41c7bbb391eac1546057247c19dc58451f83
|
|
BLAKE2b-256 checksum How to use checksums |
d2fa5896a8ddde94e57c49d05424404d186bf3acbb5148a885d13e3a5679141e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.5
|
Security for weather2 1.6.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.