-
Notifications
You must be signed in to change notification settings - Fork 0
/
run.py
56 lines (45 loc) · 1.4 KB
/
run.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
45
46
47
48
49
50
51
52
53
54
55
56
import time
from threading import Thread
from multiprocessing import freeze_support
from loguru import logger
from database.sql_db.tables import create_table
from telegram import start_tg_bot
from csgofloat import check_profile_exists
from config import TELEGRAM_ID, PRICE_UP_TO, LIMIT, TIMEOUT
from mains.main import volodya_part, get_items_form_dm, checking_sold_items
from mains.main2 import did_part
from telegram.messages import send_messages
#@logger.catch
def main(iteration_counter: int):
# for work chrome through profile
#check_profile_exists()
# first part
volodya_part()
# second part
#did_part()
logger.info(f"Iteration finished successfully №-{iteration_counter}")
if __name__ == '__main__':
#freeze_support()
create_table()
send_messages("Бот запущен!", TELEGRAM_ID)
# need for freeze program
try:
logger.add(
"csgo.log",
format="{time} {level} {message}",
level="ERROR",
rotation="10 MB",
compression="zip"
)
# run tg bot
bot_proc = Thread(target=start_tg_bot)
pars_sold_proc = Thread(target=checking_sold_items, args=(PRICE_UP_TO, LIMIT, TIMEOUT))
bot_proc.start()
pars_sold_proc.start()
count = 0
while True:
main(count)
count += 1
time.sleep(10)
finally:
input()