def ip_renew(self): """default ip renewer""" if cons.OS_WIN: try: utils.subprocess_call(["ipconfig", "/release"]) utils.subprocess_call(["ipconfig", "/renew"]) except OSError as err: logger.warning(err)
def shell_script(self, path): """""" if os.path.isfile(path): if cons.OS_WIN: try: utils.subprocess_call([path, ], shell=True) except OSError as err: logger.warning(err)
def shell_script(self, path): """""" if os.path.isfile(path): if cons.OS_WIN: try: utils.subprocess_call([ path, ], shell=True) except OSError as err: logger.warning(err)
def start_shutting(self): """""" try: if cons.OS_WIN: retcode = utils.subprocess_call(["shutdown.exe", "-f", "-s"]) else: retcode = utils.subprocess_call(["sudo", "-n", "shutdown", "-h", "now"]) if retcode >= 0: #all good. return True except Exception as err: logger.exception(err) return False
def start_shutting(self): """""" try: if cons.OS_WIN: retcode = utils.subprocess_call(["shutdown.exe", "-f", "-s"]) else: retcode = utils.subprocess_call( ["sudo", "-n", "shutdown", "-h", "now"]) if retcode >= 0: #all good. return True except Exception as err: logger.exception(err) return False
def get_captcha(self): """""" captcha = "" try: text_name = os.path.splitext(self.text_name)[0] #remove prefix for tesseract. retcode = utils.subprocess_call([get_path(), self.image_name, text_name]) if retcode >= 0: with open(self.text_name, "rb") as fh: captcha = fh.readline().strip() except Exception as err: logger.exception(err) return "" else: return captcha
def get_captcha(self): """""" captcha = "" try: text_name = os.path.splitext( self.text_name)[0] #remove prefix for tesseract. retcode = utils.subprocess_call( [get_path(), self.image_name, text_name]) if retcode >= 0: with open(self.text_name, "rb") as fh: captcha = fh.readline().strip() except Exception as err: logger.exception(err) return "" else: return captcha