Artwork

Content provided by HPR Volunteer and Hacker Public Radio. All podcast content including episodes, graphics, and podcast descriptions are uploaded and provided directly by HPR Volunteer and Hacker Public Radio or their podcast platform partner. If you believe someone is using your copyrighted work without your permission, you can follow the process outlined here https://player.fm/legal.
Player FM - Podcast App
Go offline with the Player FM app!

HPR2919: hosting software in HPR show notes

 
Share
 

Archived series ("Inactive feed" status)

When? This feed was archived on February 10, 2021 18:12 (3+ y ago). Last successful fetch was on February 26, 2021 20:39 (3+ y ago)

Why? Inactive feed status. Our servers were unable to retrieve a valid podcast feed for a sustained period.

What now? You might be able to find a more up-to-date version using the search function. This series will no longer be checked for updates. If you believe this to be in error, please check if the publisher's feed link below is valid and contact support to request the feed be restored or if you have any other concerns about this.

Manage episode 244114650 series 49648
Content provided by HPR Volunteer and Hacker Public Radio. All podcast content including episodes, graphics, and podcast descriptions are uploaded and provided directly by HPR Volunteer and Hacker Public Radio or their podcast platform partner. If you believe someone is using your copyrighted work without your permission, you can follow the process outlined here https://player.fm/legal.
#!/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 = "Jezra's fun lil script" #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={"User-Agent":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("[0-9]+",s) for match in matches: #convert string to int m = int(match) #is the speed good? if(m>=min_speed): return True #if we get here, there is no match :( return False start_url = "https://api.weather.gov/points/{0},{1}".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['properties']['forecast'] # process the forecast url forecast = get_api_data(forecast_url) #loop through the forcast periods for period in forecast['properties']['periods']: #put name and windspeed into easier to handle variable names name= period['name'] wind = period['windSpeed'] print (name, wind) #check the wind speed if wind_is_good(wind): subprocess.call(["textjezra","{0}: {1}".format(name,wind)]) 
  continue reading

3280 episodes

Artwork
iconShare
 

Archived series ("Inactive feed" status)

When? This feed was archived on February 10, 2021 18:12 (3+ y ago). Last successful fetch was on February 26, 2021 20:39 (3+ y ago)

Why? Inactive feed status. Our servers were unable to retrieve a valid podcast feed for a sustained period.

What now? You might be able to find a more up-to-date version using the search function. This series will no longer be checked for updates. If you believe this to be in error, please check if the publisher's feed link below is valid and contact support to request the feed be restored or if you have any other concerns about this.

Manage episode 244114650 series 49648
Content provided by HPR Volunteer and Hacker Public Radio. All podcast content including episodes, graphics, and podcast descriptions are uploaded and provided directly by HPR Volunteer and Hacker Public Radio or their podcast platform partner. If you believe someone is using your copyrighted work without your permission, you can follow the process outlined here https://player.fm/legal.
#!/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 = "Jezra's fun lil script" #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={"User-Agent":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("[0-9]+",s) for match in matches: #convert string to int m = int(match) #is the speed good? if(m>=min_speed): return True #if we get here, there is no match :( return False start_url = "https://api.weather.gov/points/{0},{1}".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['properties']['forecast'] # process the forecast url forecast = get_api_data(forecast_url) #loop through the forcast periods for period in forecast['properties']['periods']: #put name and windspeed into easier to handle variable names name= period['name'] wind = period['windSpeed'] print (name, wind) #check the wind speed if wind_is_good(wind): subprocess.call(["textjezra","{0}: {1}".format(name,wind)]) 
  continue reading

3280 episodes

All episodes

×
 
Loading …

Welcome to Player FM!

Player FM is scanning the web for high-quality podcasts for you to enjoy right now. It's the best podcast app and works on Android, iPhone, and the web. Signup to sync subscriptions across devices.

 

Quick Reference Guide