
Security News
CISA Kills Off RSS Feeds for KEVs and Cyber Alerts
CISA is discontinuing official RSS support for KEV and cybersecurity alerts, shifting updates to email and social media, disrupting automation workflows.
This is a wrapper for the Weatherbit API.
The Weatherbit IO allows you to access forecasts, current data, and historical data. This library wraps this functionality, and makes it accessible with Python.
You should use pip to install pyweatherbit.
For additional information, refer to the Weatherbit.io API documentation .
To use the wrapper:
from weatherbit.api import Api
api_key = "YOUR API KEY"
lat = 35.50
lon = -78.50
api = Api(api_key)
# Currently supported tp options (time period):
# History: daily, hourly, subhourly
# AGWeather History: daily, hourly
# Forecast: daily, hourly, minutely
# Air quality: hourly
# Will only affect forecast requests.
### Forecasts (daily)
# Query by lat/lon - get extended forecast out to 240 hours (default 48 hours)
api.get_forecast(lat=lat, lon=lon, days=10, tp='daily').get()
# You can also query by city:
api.get_forecast(city="Raleigh,NC", days=10, tp='daily').get()
# Or City, state, and country:
api.get_forecast(city="Raleigh", state="North Carolina", country="US", days=10, tp='daily').get()
# Or Postal code:
# See documentation for field names: https://www.weatherbit.io/api
api.get_forecast(postal_code="27601", country="US", days=10, tp='daily').get(['high_temp','low_temp','precip','weather'])
### Forecasts (hourly)
# Query by lat/lon - get extended forecast out to 240 hours (default 48 hours)
api.get_forecast(lat=lat, lon=lon, hours=240, tp='hourly').get()
# Or Postal code:
api.get_forecast(postal_code="27601", country="US", hours=240, tp='hourly').get()
### Forecasts (hourly - Air quality)
# Get an hourly air quality forecast for a lat/lon
api.get_forecast(source='airquality', lat=lat, lon=lon, tp='hourly').get()
### Forecasts (minutely / Nowcast)
# Query by lat/lon - get 60 minute precip nowcast.
api.get_forecast(lat=lat, lon=lon, tp='minutely').get()
### HISTORY
# Get sub-hourly history by lat/lon, with imperial units.
# get time series of temperature, precipitation, and rh:
api.get_history(lat=lat, lon=lon, start_date='2024-02-01',end_date='2024-02-02', tp='subhourly', units="I").get(['precip','temp','rh'])
# Or get all values. This time with metric units.
api.get_history(lat=lat, lon=lon, start_date='2024-02-01',end_date='2024-02-02', tp='subhourly', units="M").get()
# Get daily history by lat/lon
api.get_history(lat=lat, lon=lon, start_date='2024-02-01',end_date='2024-02-02', tp='daily').get()
# Get historical air quality data
api.get_history(source='airquality', lat=lat, lon=lon, start_date='2024-02-01',end_date='2024-02-02', tp='hourly').get()
# Get daily climate normals for March for location:
api.get_normals(lat=lat, lon=lon, start_day='03-01',end_day='04-01', tp='daily').get()
# Get daily climate normals for September - December for location:
# Select a few fields.
api.get_normals(lat=lat, lon=lon, start_day='09-01',end_day='01-01', tp='monthly').get(['max_temp', 'min_temp', 'precip'])
# Get daily historical AGWeather data. Select a few fields.
api.get_history(source='agweather', lat=lat, lon=lon, start_date='2024-02-01',end_date='2024-02-10', tp='daily').get(['evapotranspiration', 'soilt_0_10cm', 'v_soilm_0_10cm'])
# Get hourly historical AGWeather data. This time, get all fields.
api.get_history(source='agweather', lat=lat, lon=lon, start_date='2024-02-01',end_date='2024-02-10', tp='hourly').get()
### Current Conditions
# Get current air quality. Select a few fields.
api.get_current(source='airquality', lat=lat, lon=lon).get(['aqi','pm10','pm25'])
# Get current conditions for select fields.
api.get_current(lat=lat, lon=lon).get(['weather','temp','precip'])
# Or simply get() for all values. This time with imperial units.
api.get_current(lat=lat, lon=lon, units="I").get()
# Get weather alerts for a location
api.get_alerts(lat=lat, lon=lon).get()
# Get current conditions with alerts, and a minutely forecast for a location
api.get_current(lat=lat, lon=lon, include="alerts,minutely").get()
...
This makes an API request and returns a Forecast object (see below).
Parameters:
This makes an API request and returns a Forecast object (see below).
Parameters:
This makes an API request and returns a Forecast object (see below).
Parameters:
This makes an API request and returns a History object (see below).
Parameters:
This makes an API request and returns a History object (see below).
Parameters:
This makes an API request and returns a History object (see below).
Parameters:
This makes an API request and returns a Current Data object (see below).
Parameters:
This makes an API request and returns a Current Data object (see below).
Parameters:
This makes an API request and returns a Current Data object (see below).
Parameters:
This makes an API request and returns a Alert object (see below).
Parameters:
Gets data from Current Weather API Response (weatherbit.Api.get_current).
Parameters:
Gets data from Current Weather API Response (weatherbit.Api.get_current).
Gets data from Forecast API Response (weatherbit.Api.get_forecast).
Parameters:
Gets data from History Weather API Response (weatherbit.Api.get_history).
Parameters:
Gets data from Normals API Response (weatherbit.Api.get_normals).
Parameters:
FAQs
A python weather api wrapper for the Weatherbit.io API.
We found that pyweatherbit demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
CISA is discontinuing official RSS support for KEV and cybersecurity alerts, shifting updates to email and social media, disrupting automation workflows.
Security News
The MCP community is launching an official registry to standardize AI tool discovery and let agents dynamically find and install MCP servers.
Research
Security News
Socket uncovers an npm Trojan stealing crypto wallets and BullX credentials via obfuscated code and Telegram exfiltration.