Exemplo n.º 1
0
    parser.add_argument("-a", "--auth", help="Auth Service", required=True)
    parser.add_argument("-u", "--username", help="Username", required=True)
    parser.add_argument("-p", "--password", help="Password", required=True)
    parser.add_argument("-l", "--location", help="Location")
    parser.add_argument("-g", "--geo_key", help="GEO API Secret")
    args = parser.parse_args()

    # Check service
    if args.auth not in ['ptc', 'google']:
        logging.error('Invalid auth service {}'.format(args.auth))
        sys.exit(-1)

    # Create PokoAuthObject
    poko_session = PokeAuthSession(
        args.username,
        args.password,
        args.auth,
        geo_key=args.geo_key
    )

    # Authenticate with a given location
    # Location is not inherent in authentication
    # But is important to session
    if args.location:
        session = poko_session.authenticate(locationLookup=args.location)
    else:
        session = poko_session.authenticate()

    # Time to show off what we can do
    if session:

        # General
Exemplo n.º 2
0
    #config.get('AUTH','username')
    #config.get('AUTH','password')
    #config.get('CONFIG','startLoc')
    #config.get('CONFIG','minCP')
    #config.get('CONFIG','useBerryThreshold')
    # Check service
    useBerryThreshold = config.get('CONFIG', 'useBerryThreshold')
    minCP = int(config.get('CONFIG', 'minCP'))
    if config.get('AUTH', 'type') not in ['ptc', 'google']:
        logging.error('Invalid auth service {}'.format(
            config.get('AUTH', 'type')))
        sys.exit(-1)

    # Create PokoAuthObject
    poko_session = PokeAuthSession(config.get('AUTH', 'username'),
                                   config.get('AUTH', 'password'),
                                   config.get('AUTH', 'type'),
                                   geo_key="")

    # Authenticate with a given location
    # Location is not inherent in authentication
    # But is important to session
    if config.get('CONFIG', 'startLoc'):
        session = poko_session.authenticate(
            locationLookup=config.get('CONFIG', 'startLoc'))
    else:
        session = poko_session.authenticate()

    # Time to show off what we can do
    logging.info(
        "Successfully logged in to Pokemon Go! Starting web server on port 5100."
    )