added delays
This commit is contained in:
@@ -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'])
|
||||
|
||||
|
||||
Reference in New Issue
Block a user