<pre><code>#!/usr/bin/env python
import urllib.request
import json
import re
import subprocess

# see https://www.weather.gov/documentation/services-web-api

#where are we? GPS coordinates
lat = 39.275235
lon = -120.9199507
#what is the user agent string?
agent = &quot;Jezra&#39;s fun lil script&quot;
#minimum wind speed in mph?
min_speed = 9

def get_api_data(endpoint):
  print(endpoint)
  #prepare the connection with custom headers
  request = urllib.request.Request(endpoint, headers={&quot;User-Agent&quot;:agent})
  #create a handler for the request
  handler = urllib.request.urlopen(request)
  #get the text
  text = handler.read()
  #parse the json text to a python object
  obj = json.loads(text)
  return obj

def wind_is_good(s):
  #use regex to find the matches
  matches = re.findall(&quot;[0-9]+&quot;,s)
  for match in matches:
    #convert string to int
    m = int(match)
    #is the speed good?
    if(m&gt;=min_speed):
      return True
  #if we get here, there is no match :(
  return False

start_url = &quot;https://api.weather.gov/points/{0},{1}&quot;.format(lat,lon)
#get the json response from the start_url as a python object
obj = get_api_data(start_url)

#get the forecast url from the returned data
forecast_url = obj[&#39;properties&#39;][&#39;forecast&#39;]

# process the forecast url
forecast = get_api_data(forecast_url)

#loop through the forcast periods
for period in forecast[&#39;properties&#39;][&#39;periods&#39;]:
  #put name and windspeed into easier to handle variable names
  name= period[&#39;name&#39;]
  wind = period[&#39;windSpeed&#39;]
  print (name, wind)
  #check the wind speed
  if wind_is_good(wind):
    subprocess.call([&quot;textjezra&quot;,&quot;{0}: {1}&quot;.format(name,wind)])
</code></pre>
