config.py 文件源码

python
阅读 25 收藏 0 点赞 0 评论 0

项目:PGScout 作者: sLoPPydrive 项目源码 文件源码
def parse_args():
    global args
    defaultconfigfiles = []
    if '-c' not in sys.argv and '--config' not in sys.argv:
        defaultconfigfiles = ['config.ini']

    parser = configargparse.ArgParser(
        default_config_files=defaultconfigfiles)

    parser.add_argument('-c', '--config',
                        is_config_file=True, help='Specify configuration file.')

    parser.add_argument('-hs', '--host', default='127.0.0.1',
                        help='Host or IP to bind to.')

    parser.add_argument('-p', '--port', type=int, default=4242,
                        help='Port to bind to.')

    parser.add_argument('-hk', '--hash-key', required=True, action='append',
                        help='Hash key(s) to use.')

    parser.add_argument('-pf', '--proxies-file',
                        help='Load proxy list from text file (one proxy per line).')

    parser.add_argument('-l', '--level', type=int, default=30,
                        help='Minimum trainer level required. Lower levels will yield an error.')

    parser.add_argument('-mqj', '--max-queued-jobs', type=int, default=0,
                        help='Maximum number of queued scout jobs before rejecting new jobs. 0 (default) means no restriction.')

    parser.add_argument('-mjttl', '--max-job-ttl', type=int, default=0,
                        help='Maximum number of minutes a job is allowed to be queued before it expires (Time-To-Live). '
                             'Expired jobs will be rejected when it''s their turn. 0 (default) means no restriction.')

    parser.add_argument('-sb', '--shadowban-threshold', type=int, default=5,
                        help='Mark an account as shadowbanned after this many errors. ' +
                             'If --pgpool_url is specified the account gets swapped out.')

    parser.add_argument('-iv', '--initial-view', default="logs",
                        help=('Initial view. Can be one of "logs", "scouts" or "pokemon". Default is "logs".'))

    parser.add_argument('-pgpu', '--pgpool-url',
                        help='Address of PGPool to load accounts from and/or update their details.')

    parser.add_argument('-pgpsid', '--pgpool-system-id',
                        help='System ID for PGPool. Required if --pgpool-url given.')

    parser.add_argument('-lpf', '--low-prio-file',
                        help='File with Pokemon names or IDs that will be treated with low priority or even dropped.')

    accs = parser.add_mutually_exclusive_group(required=True)
    accs.add_argument('-pgpn', '--pgpool-num-accounts', type=int, default=0,
                      help='Use this many accounts from PGPool. --pgpool-url required.')

    accs.add_argument('-a', '--accounts-file',
                      help='Load accounts from CSV file containing "auth_service,username,passwd" lines.')

    args = parser.parse_args()
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号