Skip to content

Commit 3580f3f

Browse files
committed
get_current_issue to use existing json response
1 parent 70c3e16 commit 3580f3f

File tree

2 files changed

+8
-9
lines changed

2 files changed

+8
-9
lines changed

src/acquisition/flusurv/flusurv.py

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff 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

src/acquisition/flusurv/flusurv_update.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff 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

0 commit comments

Comments
 (0)