Python wrapper for OpenWeather API
Project description
pyopenweather
pyopenweather is a lightweight asynchronous Python wrapper for the OpenWeatherMap Current Weather Data API
Badges
Installation
Use the package manager pip to install pyopenweather.
pip install pyopenweather
Usage
API Key
OpenWeatherMap APIs require an API key to provide valid responses. Please obtain an API key on the OpenWeatherMap website.
Environment Variables
pyopenweather will search for the following environment variables when the Weather class is instantiated:
OPENWEATHER_API_KEYLATITUDELONGITUDE
OPENWEATHER_API_KEY
If you set the API key and the environment variable OPENWEATHER_API_KEY the library will use it on instantiation, otherwise the API key can be passed in as the api_key parameter.
LATITUDE
If you set the LATITUDE environment variable, the library will use it on instantiation, otherwise the latitude can be passed in as the lat parameter.
LONGITUDE
If you set the LONGITUDE environment variable, the library will use it on instantiation, otherwise the longitude can be passed in as the long parameter.
Examples
With Environment Variables
from pyopenweather.weather import Weather
weather = Weather()
weather.longitude # returns longitude
weather.latitude # returns latitude
weather.temperature # returns temperature
weather.pressure # returns temperatuire
Without Environment Variables
from pyopenweather.weather import Weather
weather = Weather(lat=37.34, long=-121.89, api_key='abcdef123456')
weather.longitude # returns longitude
weather.latitude # returns latitude
weather.temperature # returns temperature
weather.pressure # returns temperatuire
Contributing
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
Please make sure to update tests as appropriate.
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
File details
Details for the file pyopenweather-0.1.1.tar.gz.
File metadata
- Download URL: pyopenweather-0.1.1.tar.gz
- Upload date:
- Size: 4.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.1 importlib_metadata/3.10.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.9.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
95f18c7dab334105fd8f6144150d646f09bceabeb6652c05941948e4b7a14ba3
|
|
| MD5 |
05a061f6c1ad8107b608749ebfb6855c
|
|
| BLAKE2b-256 |
d130178ff1d741cf0af0c3b0daa5c5a378940c460c0a9e51584d23c83e1f4038
|