def get_last_status(cls, callback): ctx = AlertContext.current() if cls.is_retrieving: return cls.is_retrieving = False cls.callback = callback thread = Thread(target = cls.connect_and_retrieve_status) thread.start()
def connect_and_retrieve_status(cls): ctx = AlertContext.current() try: cls.is_retrieving = True time.sleep(3) conn = httplib.HTTPConnection(ctx.skink_address) url = "/status?_=%d" % random.randint(1,10000000) conn.request("GET", url) r1 = conn.getresponse() json = r1.read() json = json.decode('utf-8','replace') except Exception, message: #intentionally swallow since it does not matter why the connection was refused. cls.is_retrieving = False return
def __init__(self): self.initialize() self.ctx = AlertContext.current() self.resources = Resources() self.resources.preload() self.is_failing = False
def __init__(self): self.ctx = AlertContext.current()
def __init__(self, game): self.game = game self.ctx = AlertContext.current()