def main(): global todos nox = App.open("Nox App Player") with Region(nox.window()): lib.login() lib.checkOK() lib.checkSkip() lib.reset() if todos["temple"] or todos["summoning"]: todos = dungeons.run(todos) lib.reset() if exists("1515159000793.png"): click("1515159012057.png") if todos["sub"]: if exists("1515079317950.png"): print("claiming reward") click("1515079317950.png") todos = weeklys.sub(todos) if todos["daily"]: lib.reset() if exists("1514888901019-1.png"): click("1514888901019-1.png") if exists("1515047937858.png"): click("1515047937858.png") todos = acceptDailys(todos) if not todos["sub"] and not todos["temple"] and not todos["summoning"]: lib.reset() todos = weeklys.run(todos)
def run(self): """ Runs the mode if triggered. :return: """ url = lib.ulcli.args('url') + '/api/v1/admin/token' l_res = lib.login(self.__lang, lib.ulcli.args('username'), lib.ulcli.args('password')) g_res = response(self.__lang, requests.post(url, headers={'Authorization': 'Bearer %s' % l_res.get('jws')})) print('Token: %s' % g_res.get('token'))
def setUpClass(cls): cls.driver = webdriver.Chrome() cls.driver.maximize_window() cls.driver.implicitly_wait(2) cls.data_list = excel_to_list(data_file, "AddPartcipant_page") # 读取该测试类所有用例数据 cls.url = test_env + Participants_add cls.driver, cls.name = login(cls.driver, '管理员') TestKapbookAddPartcipant.data_original = {} #类变量,类名+变量名,可进行调用操作 cls.par = ParticipantPage(cls.driver) cls.sp = CompListPage(cls.driver) cls.sp.op_click('第一个企业有限公司')
def setUpClass(cls): cls.driver = webdriver.Chrome() cls.driver.maximize_window() cls.driver.implicitly_wait(3) cls.data_list = excel_to_list(data_file, "holdingPlatform") # 读取该测试类所有用例数据 cls.url = test_env + holdPlatform cls.driver, cls.name = login(cls.driver, '管理员') TestKapbookaddPlatform.data_original = {} # 类变量,类名+变量名,可进行调用操作 cls.hold = HoldplatformPage(cls.driver) cls.sp = CompListPage(cls.driver) cls.sp.op_click('第一个企业有限公司')
def test_4_normal_user_check(self): """一般用户登录后公司列表页登录状态校验""" self.driver, self.name = login(self.driver, '一般用户') sp = CompListPage(self.driver) realname = sp.show_text('当前用户姓名') try: self.assertEqual(self.name, realname) log_case_info('CompList-4', '一般用户登录', 'PASS', '无', self.name, realname) except Exception as e: log_case_info('CompList-4', '一般用户登录', 'FAILED', '无', self.name, realname)
def test_1_admin_check(self): """管理员登录后公司列表页登录状态校验""" self.driver, self.name = login(self.driver, '管理员') sp = CompListPage(self.driver) realname = sp.show_text('当前用户姓名') try: self.assertEqual(self.name, realname) log_case_info('CompList-1', '管理员登录', 'PASS', '无', self.name, realname) except Exception as e: log_case_info('CompList-1', '管理员登录', 'FAILED', '无', self.name, realname)
def slogin(self, widget): if widget.get_active(): self.spinner.start() self.loginbutton.set_label("Logging in...") username = self.userentry.get_text() password = self.passentry.get_text() if username and password: ezck = login(username, password) if ezck: self.spinner.stop() self.loginbutton.set_label('Logged in.') LOGGEDIN = True self.destroy() else: self.spinner.stop() self.button.set_label("Login")
def run(self): """ Runs the mode if triggered. :return: """ url = lib.ulcli.args('url') + '/api/v1/admin/manage' l_res = lib.login(self.__lang, lib.ulcli.args('username'), lib.ulcli.args('password')) res = response( self.__lang, requests.post( url, data={ "url": lib.ulcli.args('main_url'), "key": lib.ulcli.args('admin_token') }, headers={'Authorization': 'Bearer %s' % l_res.get('jws')})) print(res)
print("这是微信") import lib #飘红不代表报错 print(globals()) lib.login() lib.register() a = 10 print(lib.a) print(a)
def main(arg): parser = argparse.ArgumentParser(description='Process, upload and Post books on Evilzone Forum.') parser.add_argument("-f", "--file", dest="filename", required=False, help="Ebook to process, upload and post on Evilzone", metavar="FILENAME",type=lambda x:is_valid(parser,x)) parser.add_argument("-F", "--folder", required=False, type=lambda x:is_valid(parser,x), help="Folder to get books from.")#lambda func to verify time format args = parser.parse_args() cookies = login() extensions = ['.pdf', '.epub', '.mobi', '.chm'] getBooksIndex() try: with open(os.path.join(lib.evilbookup_folder, 'log.json'), 'r') as f: lib.booklog = json.load(f) except ValueError as e: pass def process(filename): filenm, ext = os.path.splitext(filename) if ext in extensions: if filename.endswith(".pdf"): #moved this check to lib.process_file(), because filesystem file name (might) # differs from real book publication name hence dupe fail positives. #dupe = isdupe(filename);print(dupe);exit() #if not dupe: # process_file(filename) #else: # print('\'{0}\' already exists as \'{1}\' @ {2} Skipping...'.format(filename, dupe[0], dupe[1])) process_file(filename) #file not pdf else: #TODO: insert success conversion check here and in function return parameters, true/false newfilename = convert2pdf(filename) #change this return value to a path. process_file(newfilename) if args.filename: process(args.filename) elif args.folder: for filename in os.listdir(args.folder): process(filename) else: print("\nNo filename or folder specified, checking in current directory...") files = os.listdir('.') found_book = False for filename in files: filenm, ext = os.path.splitext(filename) if ext in extensions: found_book = True process(filename) if not found_book: print('No BOOK found in current directory. Please specify a file or folder to process books from.') sys.exit() #dump the log back to file, prolly updated or not with open(os.path.join(lib.evilbookup_folder, 'log.json'), "w") as f: json.dump(lib.booklog, f, indent=4) print("Books processing is DONE, please review the {} folder for the BBcode to post to Evilzone.org".format(lib.bbcodedir))
import lib if __name__ == "__main__": user = lib.login() while True: if user.name == 'root': choice = input('''1.add Teacher 2.del Teacher 3.add Lesson 4 del Lesson 5.add Student 6.del Student''') if choice == '1': user.add_teacher() elif choice == '2': user.remove('Teacher') elif choice == '3': user.add_lesson() elif choice == '4': user.remove('Lesson') elif choice == '5': user.add_student() elif choice == '6': user.remove('Student') elif not choice: continue elif choice == 'q': break else: choice = input( '''1.add Lesson 2.history 3.learn 4.evaluate''') if choice == '1': user.add_lesson() elif choice == '2': user.show_lesson()
import lib name = input("이름을 입력해주세요: ") lib.login(name)
from lib import login, searchCourse from app import show_gui from send_email import send_text, send_email import time from email.mime.text import MIMEText from email.mime.multipart import MIMEMultipart if __name__ == '__main__': #get credentials from GUI credentials = show_gui() while(True): #send crendentials over to bot and run driver = login(credentials) info = searchCourse(credentials, driver) availibleSeats = str(info[0]) classTitle = info[1] #print("Availible seats: " + str(availibleSeats)) time.sleep(1) driver.close() if (int(availibleSeats) > 0): message = MIMEMultipart("alternative") message["Subject"] = "Your class " + classTitle + " is open!" text = """There are """ + availibleSeats + """ seat(s) available! Hurry and register before somebody takes your spot. \n\nThank you for using SABRE III!"""