Example #1
0
 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)
Example #2
0
 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)
Example #3
0
 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)
Example #4
0
 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)
Example #5
0
 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
Example #6
0
 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
Example #7
0
 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
Example #8
0
 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