Пример #1
0
#! python3
import traceback
from connect import Connection
from parse import *
import time
import select

try:
    settings = settings_load()
except IOError:
    print("No settings file found, please run file run_me_first.py")
    raise SystemExit

connection = Connection(settings)
connection.connect()
connection.registration()
connection.sock.setblocking(0)
module_dict = get_module_objects()
timestamps = {}
for item in module_dict:
    timestamps[item] = time.ctime(os.path.getmtime(item))

while True:
    try:
        ready = select.select([connection.sock], [], [], 5)
        if ready[0]:
            if connection.ssl == True:
                buffer = connection.sock.read(4096)
            else:
                buffer = connection.sock.recv(4096)
            buffer = str(buffer, "utf-8")