File tree Expand file tree Collapse file tree
PyPortal_Hurricane_Tracker Expand file tree Collapse file tree Original file line number Diff line number Diff line change 2020LON_RANGE = (- 100 , - 40 ) # set to match map
2121# --------------------------------------------------------------------
2222
23+ URL = "https://www.nhc.noaa.gov/CurrentStorms.json"
24+ JSON_PATH = ["activeStorms" ]
25+
2326# setup pyportal
2427pyportal = PyPortal (
25- url = "https://www.nhc.noaa.gov/CurrentStorms.json" ,
26- json_path = ["activeStorms" ],
2728 status_neopixel = board .NEOPIXEL ,
2829 default_bg = "/map.bmp" ,
2930)
6162
6263
6364def update_display ():
65+ # pylint: disable=too-many-locals
6466 # clear out existing icons
6567 while len (storm_icons ):
6668 _ = storm_icons .pop ()
6769
6870 # get latest storm data
6971 try :
70- storm_data = pyportal .fetch ()
72+ resp = pyportal .network .fetch (URL )
73+ storm_data = pyportal .network .process_json (resp .json (), (JSON_PATH ,))[0 ]
7174 except RuntimeError :
7275 return
7376 print ("Number of storms:" , len (storm_data ))
You can’t perform that action at this time.
0 commit comments