Bugfix
This commit is contained in:
parent
8ae95f3e0d
commit
c7ac053c52
1 changed files with 8 additions and 2 deletions
|
@ -169,11 +169,17 @@ def run(taal, start, stop):
|
|||
while start != stop:
|
||||
|
||||
# Pagina inladen.
|
||||
pagina = requests.get(base + converteer(start, False))
|
||||
try:
|
||||
pagina = requests.get(base + converteer(start, False))
|
||||
except:
|
||||
return {'error': f"Er ging iets fout bij het inladen van '{start}'. Bestaat de website?"}
|
||||
|
||||
# Stoppen indien het inladen van de pagina niet lukte.
|
||||
if pagina.status_code != 200:
|
||||
return {'error': f"Er ging iets fout bij het inladen van '{lijst[-1]}', vertrekkende vanaf '{lijst[0]}'. Bestaat de website?"}
|
||||
if len(lijst) == 0:
|
||||
return {'error': f"Er ging iets fout bij het inladen van '{start}'. Bestaat de website?"}
|
||||
return {
|
||||
'error': f"Er ging iets fout bij het inladen van '{lijst[-1]}', vertrekkende vanaf '{lijst[0]}'. Bestaat de website?"}
|
||||
|
||||
# Verwerken.
|
||||
soep = BeautifulSoup(pagina.content, 'html.parser')
|
||||
|
|
Reference in a new issue