Skip to content

Commit

Permalink
initial switch to new API endpoint; doesn't account for format change
Browse files Browse the repository at this point in the history
  • Loading branch information
nmdefries committed Aug 21, 2023
1 parent 01365a1 commit 734dca9
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions src/acquisition/flusurv/flusurv.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,11 +123,15 @@ def fetch_json(path, payload, call_count=1, requests_impl=requests):
def fetch_flusurv_object(location_code):
"""Return decoded FluSurv JSON object for the given location."""
return fetch_json(
"PostPhase03GetData",
"PostPhase03DataTool",
{
"appversion": "Public",
"networkid": location_code[0],
"cacthmentid": location_code[1],
"key": "",
"injson": [
"networkid": location_code[0],
"cacthmentid": location_code[1]
# Also need `seasonid` here?
],
},
)

Expand Down Expand Up @@ -210,7 +214,10 @@ def get_current_issue():
"""Scrape the current issue from the FluSurv main page."""

# fetch
data = fetch_json("GetPhase03InitApp?appVersion=Public", None)
data = fetch_json(
"PostPhase03DataTool",
{"appversion": "Public", "key": "", "injson": []}
)

# extract
date = datetime.strptime(data["loaddatetime"], "%b %d, %Y")
Expand Down

0 comments on commit 734dca9

Please sign in to comment.