utils.py¶
-
utils.
get_JSON
(URL: str) → Dict[source]¶ Request JSON from API server.
GET requests to URL provided to the function and return a python dict. APIs like NHL have a wrapper so handles that as well.
- Parameters
URL (str) – [description]
- Returns
JSON object that was parsed into a python dictionary
- Return type
Dict
-
utils.
get_date
(delta: int) → str[source]¶ Build a date object with given day offset.
Function is necessary to check games for NHL since the API returns games for entire week. Get the date as a string in a particular format used in JSON returned from NHL API.
- Parameters
delta (int) – Offset
- Returns
Date in the format “%Weekday %-month%-dayofmonth”
- Return type
str