Compare commits
1 Commits
ba15e3cad3
...
76e0438062
| Author | SHA1 | Date |
|---|---|---|
|
|
76e0438062 |
|
|
@ -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}")
|
||||
|
|
|
|||
Loading…
Reference in New Issue