From da64b59cfbf8aab73b7bd72165b8a5e6ba10a034 Mon Sep 17 00:00:00 2001 From: dece Date: Mon, 15 Mar 2021 20:19:30 +0100 Subject: [PATCH] get-definitions: slow down big boy --- get_definitions.py => get-definitions.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) rename get_definitions.py => get-definitions.py (94%) diff --git a/get_definitions.py b/get-definitions.py similarity index 94% rename from get_definitions.py rename to get-definitions.py index 791d936..d084d55 100644 --- a/get_definitions.py +++ b/get-definitions.py @@ -1,5 +1,6 @@ import os import sys +import time import urllib.parse from pathlib import Path @@ -26,6 +27,7 @@ def main(): else: start_from = "" get_definitions(form) + time.sleep(5000) except OSError: exit("Could not open forms list file.") @@ -39,8 +41,7 @@ def get_definitions(form): # Check other definitions. tabs_bar = soup.find("div", id="vtoolbar") if not tabs_bar: - sys.stderr.write("No tabs bar!\n") - return + exit("No tabs bar!\n") num_defs = len(tabs_bar("li")) for variant in range(1, num_defs): # skip the first, we got it above. variant_url = url + f"/{variant}" @@ -60,8 +61,7 @@ def get_page(url): def process_definition_page(soup, form, variant): definition = soup.find("div", id="lexicontent") if not definition: - sys.stderr.write("No definition!\n") - return + exit("No definition!\n") save_definition(form, variant, definition.prettify())