def main(): target_dir = MANIFEST_PATH.parent for filename, url in collect_manifest(): target_path = target_dir.joinpath(filename) _bx = existed_size(target_path) if _bx: mylog(f"{target_path} already exists, with {_bx} bytes", label='Skipping') else: mylog(url, label='Fetching') content = download(url) target_path.parent.mkdir(exist_ok=True, parents=True) with open(target_path, 'wb') as target: for cx in content: target.write(cx) mylog(f"{existed_size(target_path)} bytes to {target_path}", label='Wrote')
# -*- coding:utf-8 -*- import time import unittest from selenium import webdriver import sys, os from appium import webdriver parentdir = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) sys.path.append(parentdir) from utils.mylog import mylog from utils import config from selenium.webdriver.support import expected_conditions as EC Log = mylog() logger = Log.get_log().get_logger() ######################################################################## class test_kaoyanbang(unittest.TestCase): """""" @classmethod def setUpClass(cls): data = config.yaml_conf().data desired_caps = config.yaml_conf().desired_caps cls.driver = webdriver.Remote( 'http://' + str(data['ip']) + ':' + str(data['port']) + '/wd/hub', desired_caps) logger.debug(time.time()) cls.driver.wait_activity("com.tal.kaoyan.ui.activity.SplashActivity", 10) logger.debug(time.time()) cls.driver.implicitly_wait(5) logger.debug("启动考研帮...")