def run(self): global reboot if self.cli_run(): return -1 # 开始执行 while True: # print('\nin Run...') url = "http://www.mobtop.com.cn/index.php?s=/Api/MalaysiaApi/sqlWhere" data = { "name": "travel_business_list", "where": "status=1 or status=2 or submit_status=3" } res = requests.post(url, data=data, timeout=5) if res.json(): self.auto = AutomationPipelines() if not self.auto.data(): break # 数据处理 # print('\n有数据进行提交\n') # 获取需要申请的人员信息 self.all_data() self.control[self.status]() else: self.auto = None # print('没有数据, 等待...', strftime('%m/%d %H:%M:%S')) if self.cli.refresh(self.req): break reboot = 3 for infile in glob.glob(os.path.join(BASE_DIR, '*.pdf')): os.remove(infile) sleep(5)
def run(self): sleep(1) try: self.search_info() sleep(1) self.undo() except AttributeError as ate: self.auPipe.update(tid=self.LOG_DATA[7], status='2') raise AutomationError(ate, "automation_undo") except IndexError: self.auPipe.update(tid=self.LOG_DATA[7], status='2') raise AutomationError("列表超出范围", "automation_undo") except AutomationError: raise AutomationError('登陆失效, 重新登陆...', "automation_undo") except Exception as e: # print('automation_undo 出现错误...') ERRINFO(self.LOG_DATA[7], self.LOG_DATA[1], "automation_undo", e) raise AutomationError(e, "automation_undo")
def undo(self): data = { 'IDENTITY_ID': self.identity_id, 'CANCEL_TYPE': random.choice(['2', '3']) } res = self.req.post( 'https://churenkyosystem.com/member/set_cancel_identity.php', data=data) if res.url == self.login_url: raise AutomationError('登陆失效, 重新登录...') sleep(3) self.auPipe.update(tid=self.LOG_DATA[7], submit_status='111') # print('==========\n撤回请求成功!\n==========') with open(os.path.join(LOG_DIR, f'{DAY()}.json'), 'a') as f: log = {'撤销': self.LOG_DATA, 'id': self.LOG_DATA[-1], 'time': strftime('%m/%d %H:%M:%S')} json.dump(log, f) f.write(',\n') res = self.req.get('https://churenkyosystem.com/member/top.php') if res.url == self.login_url: raise AutomationError('登陆失效...')
def open_client(): m = PyMouse() m.click(10000, 10000) sleep(2) k = PyKeyboard() sleep(2) subprocess.Popen(EXE_PWD) sleep(2) m.click(COORDINATES_1[0], COORDINATES_1[1]) sleep(2) k.type_string(PASSWD_EXE) sleep(2) m.click(COORDINATES_2[0], COORDINATES_2[1]) sleep(60)
stop_zsk = True # Check if DS record has been found if result_ds > 0: # Gaining DS is available in the parent zone , and sends the email (if possible) to the registrar print("\nYour DS record has appeared in the parent zone for domain: " + check_domain.domain) if stop_ds is False: print("Loosing ZSK in your child zone can be removed") if send_email is not False: print('start sending DS email...') subject = "Parent zone updated for " + check_domain.domain content = "Your DS record has appeared in the parent zone for domain: " + check_domain.domain tranfertime = "The NS record can be updated in the parent zone at: " + convert_date( check_domain.ttl) + "." send_mail(subject, content, tranfertime) print('DS email send') # Stop the DS search after sending the email stop_ds = True # Set the stop variables to true if repeat is false if repeat_query is False: stop_zsk = True stop_ds = True # Check if one or both stops are not true to make the script pause for a set time if stop_ds is False or stop_zsk is False: # Gaining ZSK and/ or DS is not available in the zone yet, try again automatically in TTL minutes print("\n \nSleeping search for", ttl_conv, "on", check_domain.domain) sleep(check_domain.ttl)