Compare commits

..

1 Commits

Author SHA1 Message Date
Andrei Stoica 76e0438062 moved from urllib to requests
continuous-integration/drone/push Build is passing Details
2023-05-18 09:09:12 -04:00
1 changed files with 3 additions and 3 deletions

View File

@ -76,10 +76,10 @@ def reparse_ingredients(session):
def load_page(recipe_url):
try:
logging.info(f'Loading Page: {recipe_url}')
with req.get(recipe_url) as f:
if f.status_code == 404:
with req.get(recipe_url) as resp:
if resp.status_code == 404:
raise Exception(f"Page does not exist (404): {recipe_url}")
return bs4.BeautifulSoup(f.read().decode(), 'html.parser')
return bs4.BeautifulSoup(resp.text, 'html.parser')
except Exception as e:
logging.warning(f"Could not download or parse recipe: {recipe_url}")