File tree Expand file tree Collapse file tree 2 files changed +8
-9
lines changed
Expand file tree Collapse file tree 2 files changed +8
-9
lines changed Original file line number Diff line number Diff line change @@ -217,15 +217,12 @@ def get_data(location_code):
217217 return data_out
218218
219219
220- def get_current_issue ():
221- """Scrape the current issue from the FluSurv main page."""
222-
223- # fetch
224- data = fetch_json (
225- "PostPhase03DataTool" ,
226- {"appversion" : "Public" , "key" : "" , "injson" : []}
227- )
220+ def get_current_issue (data ):
221+ """
222+ Extract the current issue from the FluSurv API result.
228223
224+ data: dictionary representing a JSON response from the FluSurv API
225+ """
229226 # extract
230227 date = datetime .strptime (data ["loaddatetime" ], "%b %d, %Y" )
231228
Original file line number Diff line number Diff line change @@ -175,8 +175,10 @@ def main():
175175 # fmt: on
176176 args = parser .parse_args ()
177177
178+ data = fetch_flusurv_object ()
179+
178180 # scrape current issue from the main page
179- issue = flusurv .get_current_issue ()
181+ issue = flusurv .get_current_issue (data )
180182 print (f"current issue: { int (issue )} " )
181183
182184 # fetch flusurv data
You can’t perform that action at this time.
0 commit comments