Open Source client wrapper in Python for interfacing with the Scenic Weather data REST API
Python 3.7 or higher is required.
pyScenicWeather is available on Pypi and can be installed with pip
:
# Linux
pip install pyScenicWeather
# Windows
$ pip install pyScenicWeather
With a free Scenic Weather API Key:
from scenic import Scenic
current_weather = None
with Scenic('your-API-key') as weatherBy: # You MUST provide a valid API key
# Search for current weather in Toronto (Canada)
# Defaults to current weather measurement
current_weather = weatherBy.city(city='Toronto', country='CA')
if current_weather is not None:
print(current_weather)
# Weather details
print(f"Temperature: {current_weather.temperature}")
print(f"Humidity: {current_weather.humidity}")
print(f"Wind Speed: {current_weather.wind.speed}")
print(f"Wind Direction: {current_weather.wind.direction}")
print(current_weather.__readings__)
# Get the current weather at lat=43.65N, lon=79.38W (Toronto, Canada)
observation = weatherBy.lat_lon(latitude=43.65, longitude=-79.38, metric_units=False).forecast(plus_hour=1)
print(observation)
You can find more examples in our examples directory.
As Scenic Weather APIs require a valid API key to allow responses, pyScenicWeather will not work without one. You can get a free API key on the Scenic website Do note that free API subscription plans are subject to requests throttling.
The library software API documentation is available on Read the Docs.
Licensed under the MIT License.