Make current year param default
This commit is contained in:
1 parent
033b0cf028
commit
4cf8c0e446
1 file changed
+1
-4
+1
-4
@@ -12,7 +12,7 @@ from bs4 import BeautifulSoup
|
|||||||
|
|
||||||
load_dotenv()
|
load_dotenv()
|
||||||
|
|
||||||
def scrape_game_history(game: str, year: int | None = None) -> dict:
|
def scrape_game_history(game: str, year: int = utils.today().year) -> dict:
|
||||||
"""
|
"""
|
||||||
Scrape game data from the url provided. This function requires specific environment variables be present
|
Scrape game data from the url provided. This function requires specific environment variables be present
|
||||||
in order to function properly.
|
in order to function properly.
|
||||||
@@ -30,9 +30,6 @@ def scrape_game_history(game: str, year: int | None = None) -> dict:
|
|||||||
"""
|
"""
|
||||||
drawings = {}
|
drawings = {}
|
||||||
|
|
||||||
if year is None:
|
|
||||||
year = utils.today().year
|
|
||||||
|
|
||||||
url = f"{os.getenv('BASE_SCRAPE_URL')}{game}/numbers/{year}"
|
url = f"{os.getenv('BASE_SCRAPE_URL')}{game}/numbers/{year}"
|
||||||
page = httpx.get(url)
|
page = httpx.get(url)
|
||||||
soup = BeautifulSoup(page.text, 'html.parser')
|
soup = BeautifulSoup(page.text, 'html.parser')
|
||||||
|
|||||||
Reference in new issue
Block a user