Compare commits
1 Commits
76e0438062
...
ba15e3cad3
| Author | SHA1 | Date |
|---|---|---|
|
|
ba15e3cad3 |
|
|
@ -76,10 +76,10 @@ def reparse_ingredients(session):
|
||||||
def load_page(recipe_url):
|
def load_page(recipe_url):
|
||||||
try:
|
try:
|
||||||
logging.info(f'Loading Page: {recipe_url}')
|
logging.info(f'Loading Page: {recipe_url}')
|
||||||
with req.get(recipe_url) as resp:
|
with req.get(recipe_url) as f:
|
||||||
if resp.status_code == 404:
|
if f.status_code == 404:
|
||||||
raise Exception(f"Page does not exist (404): {recipe_url}")
|
raise Exception(f"Page does not exist (404): {recipe_url}")
|
||||||
return bs4.BeautifulSoup(resp.text, 'html.parser')
|
return bs4.BeautifulSoup(f.read().decode(), 'html.parser')
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logging.warning(f"Could not download or parse recipe: {recipe_url}")
|
logging.warning(f"Could not download or parse recipe: {recipe_url}")
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue