-
Notifications
You must be signed in to change notification settings - Fork 41
/
Copy pathmain.py
44 lines (27 loc) · 889 Bytes
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
__author__ = "ipetrash"
import datetime as dt
import sys
import traceback
# pip install simple-wait
from simple_wait import wait
sys.path.append("../html_parsing")
from get_stackoverflow_people_reached import get_stackoverflow_people_reached
from db import PeopleReached, db_create_backup
URL = "https://ru.stackoverflow.com/users/201445/gil9red"
while True:
print(f"Started at {dt.datetime.now():%d/%m/%Y %H:%M:%S}\n")
db_create_backup()
try:
value = get_stackoverflow_people_reached(URL)
print(f"URL: {URL}\n {value}\n")
PeopleReached.append(URL, value)
wait(weeks=1)
except Exception as e:
# Выводим ошибку в консоль
tb = traceback.format_exc()
print(tb)
print("Wait 15 minutes")
wait(minutes=15)
print()