bg_filename = './data/bilibg.jpg' gap_filename = './data/biligap.jpg' bg_location_list, gap_location_list = self.get_images( bg_filename, gap_filename) bg_img = merge_img(bg_filename, bg_location_list) gap_img = merge_img(gap_filename, gap_location_list) gap = get_gap(bg_img, gap_img) # print('缺口位置', gap) track = get_track(gap - self.BORDER) print('滑动滑块') # print("track", track) slider = self.get_slider() self.move_to_gap(slider, track) if self.browser.current_url == self.url: print("登录失败") else: print("登录成功") if __name__ == '__main__': name = read_conf("bili_info", "username") passwd = read_conf("bili_info", "password") LBP = LoginBiliPc(name, passwd) LBP.main()
def main(self): """ 主函数 :return: """ print("开始登录") # 打开浏览器 self.browser.get(self.url) # 选择密码登录 self.choose_username() # 输入注册数据 self.input_data() # 获取滑块 slider = self.get_slider() # 构造轨迹 track = get_track(300 - self.BORDER) # # 拖动滑块到右侧(300px) self.move_to_gap(slider, track) if self.browser.current_url == self.url: print("注册失败") else: print("注册成功") if __name__ == '__main__': name = read_conf("taobao_info", "username") passwd = read_conf("taobao_info", "password") LTP = LoginTaobaoPc(name, passwd) LTP.main()
# -*-coding:utf-8-*- """ gunicorn start flask api author @boole date 2019-05-01 """ import multiprocessing from load_conf import read_conf host = read_conf("dev", "host") port = read_conf("dev", "port") pidpath = read_conf("dev", "pidpath") logpath = read_conf("dev", "logpath") cpu_cnt = multiprocessing.cpu_count() # 计算cpu数 一般并发数为cpu * 2 + 1 bind = ":".join(list([host, port])) backlog = 2048 workers = cpu_cnt * 2 + 1 worker_class = "sync" worker_connections = 1000 timeout = 30 reload = True reload_engine = "auto" debug = True proc_name = 'gunicorn_flask.proc' pidfile = pidpath + "gunicorn.pid" logfile = logpath + "debug.log" loglevel = 'info'
ActionChains(self.browser).release().perform() def main(self): """ 主函数 :return: """ print("开始注册") # 打开浏览器 self.browser.get(self.url) # 点按同意协议 self.click_agree() # 输入注册数据 self.input_data() # 获取滑块 slider = self.get_slider() # 构造轨迹 track = get_track(300 - self.BORDER) # 拖动滑块到右侧(300px) self.move_to_gap(slider, track) if self.browser.current_url == self.url: print("注册失败") else: print("注册成功") if __name__ == '__main__': phone = read_conf("taobao_info", "phone") LTP = LoginTaobaoPc(phone) LTP.main()