added delays

This commit is contained in:
2026-04-05 11:56:16 +03:00
parent 3b15cd5037
commit 4e357e52f8
3 changed files with 76 additions and 5 deletions

View File

@@ -18,7 +18,7 @@ def sibling_clear_to_date(s: str):
return s.lower().replace("(последнее изменение:", "").replace(")", "").strip()
# Парсит ссылки на эксель .xls & .xlsx файлы и выдаёт их
def parse_links(facultets):
def parse_links(facultets, DEBUG_NO_LINKS_DELAY=False):
session = requests.Session()
session.headers = CaseInsensitiveDict(
{
@@ -58,9 +58,11 @@ def parse_links(facultets):
}
print("Found in vstu.ru: ", record)
EXCEL_LINKS.append(record)
st = random.randint(1, 10)/10
print(f"sleep {st}s")
time.sleep(st)
if not DEBUG_NO_LINKS_DELAY:
st = random.randint(1, 10)/10
print(f"sleep {st}s")
time.sleep(st)
return sorted(EXCEL_LINKS, key=lambda x: x['url'])