Exemplo n.º 1
0
def cfg_init():
    log.info("Loading PGScout configuration...")

    parse_args()

    # MrMime config
    mrmime_cfg = {
        'pgpool_system_id': args.pgpool_system_id,
        'exception_on_captcha': True
    }
    if args.pgpool_url:
        mrmime_cfg['pgpool_url'] = args.pgpool_url
        log.info("Attaching to PGPool at {}".format(args.pgpool_url))
    init_mr_mime(mrmime_cfg)

    # Collect hash keys
    args.hash_key_provider = CyclicResourceProvider()
    for hk in args.hash_key:
        args.hash_key_provider.add_resource(hk)

    # Collect proxies
    args.proxies = check_proxies(cfg_get('proxies_file'))
    args.proxy_provider = CyclicResourceProvider()
    for proxy in args.proxies:
        args.proxy_provider.add_resource(proxy)
Exemplo n.º 2
0
def cfg_init():
    log.info("Loading PGScout configuration...")

    parse_args()

    # MrMime config
    mrmime_cfg = {
        'pgpool_system_id': args.pgpool_system_id,
        'exception_on_captcha': True
    }
    if args.pgpool_url:
        mrmime_cfg['pgpool_url'] = args.pgpool_url
        log.info("Attaching to PGPool at {}".format(args.pgpool_url))
    init_mr_mime(mrmime_cfg)

    # Collect hash keys
    args.hash_key_provider = CyclicResourceProvider()
    for hk in args.hash_key:
        args.hash_key_provider.add_resource(hk)

    # Collect proxies
    args.proxies = check_proxies(cfg_get('proxies_file'))
    args.proxy_provider = CyclicResourceProvider()
    for proxy in args.proxies:
        args.proxy_provider.add_resource(proxy)

    args.low_prio_pokemon = []
    if args.low_prio_file:
        with open(args.low_prio_file) as f:
            args.low_prio_pokemon = read_pokemon_ids_from_file(f)
        if args.low_prio_pokemon:
            log.info("{} low priority Pokemon loaded from {}".format(len(args.low_prio_pokemon), args.low_prio_file))
            t = Thread(target=watch_low_prio_file, args=(args.low_prio_file,))
            t.daemon = True
            t.start()