Example #1
0
if __name__ == "__main__":
    logging.basicConfig(level=logging.ERROR)
    (host, port, opts, pcfg) = parse_args()

    if opts.logfile:
        config_logging(opts.logfile)

    if opts.loglvl:
        logging.root.setLevel(getattr(logging, opts.loglvl.upper()))

    if opts.user:
        while True:
            password = getpass("Minecraft account password: "******"Authenticating with %s" % opts.user)
            if auth.check():
                break
            logger.error("Authentication failed")
        logger.debug("Credentials are valid")

    if opts.authenticate or opts.password_file:
        if opts.authenticate:
            credentials = minecraft_credentials()
            if credentials is None:
                logger.error("Can't find password file. " +
                             "Use --user or --password-file option instead.")
                sys.exit(1)
            user, password = credentials
        else:
            try:
                with open(opts.password_file) as f:
Example #2
0
if __name__ == "__main__":
    logging.basicConfig(level=logging.ERROR)
    (host, port, opts, pcfg) = parse_args()

    if opts.logfile:
        util.config_logging(opts.logfile)

    if opts.loglvl:
        logging.root.setLevel(getattr(logging, opts.loglvl.upper()))

    if opts.user:
        while True:
            password = getpass("Minecraft account password: "******"Authenticating with %s" % opts.user)
            if auth.check():
                break
            logger.error("Authentication failed")
        logger.debug("Credentials are valid")

    if opts.authenticate or opts.password_file:
        if opts.authenticate:
            credentials = minecraft_credentials()
            if credentials is None:
                logger.error("Can't find password file. " +
                             "Use --user or --password-file option instead.")
                sys.exit(1)
            user, password = credentials
        else:
            try:
                with open(opts.password_file) as f: