LINUX.ORG.RU

История изменений

Исправление vvn_black, (текущая версия) :

#!/usr/bin/python3.5

import socket;
import threading;


class Clicker(object):
    prev_button = None

    def click(self, button=None):
        if button != self.prev_button:
            self.prev_button = button
            print(button)


def CUSTOMPORT():
    threading.Timer(1.0, CUSTOMPORT).start()
    sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
        result = sock.connect_ex(("192.168.1.10",80))
        if result == 0:
            clc.click("Run")
        else:
            clc.click("Down")

clc = Clicker()
CUSTOMPORT()

Исходная версия vvn_black, :

#!/usr/bin/python3.5

import socket;
import threading;


class Clicker(object):
    prev_button = None

    def click(self, button=None):
        if button != self.prev_button:
            self.prev_button = button
            print(button)


def CUSTOMPORT():
        threading.Timer(1.0, CUSTOMPORT).start()
        sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
        result = sock.connect_ex(("192.168.1.10",80))
        if result == 0:
                cl.click("Run")
        else:
                clc.click("Down")

clc = Clicker()
CUSTOMPORT()