コード例 #1
0
ファイル: polib.py プロジェクト: mikaelkall/pokemon-bot
    def __api_connect(self):

	api_user = str(self.username).strip()
	api_pass = str(self.password).strip()
	api_auth = str(self.auth).strip()
	api_geo  = str(self.geo_key).strip()
	api_map  = str(self.map_location).strip()

        # Check service
        if self.auth not in ['ptc', 'google']:
            self.__puts('error',"Invalid auth service %s" % ( self.auth ))
            sys.exit(-1)

	# Create PokoAuthObject
        poko_session = PokeAuthSession(
            api_user,
            api_pass,
            api_auth,
            geo_key=api_geo
        )

        if self.map_location:
            session = poko_session.authenticate(locationLookup=api_map)
        else:
            session = poko_session.authenticate()

        if session:
	    return session
        else:
            self.__puts('error','Session not created successfully')
	    sys.exit(-1)
コード例 #2
0
ファイル: polib.py プロジェクト: mikaelkall/pokemon-bot
    def __simpleBot2(self):

        api_user = str(self.username).strip()
        api_pass = str(self.password).strip()
        api_auth = str(self.auth).strip()
        api_geo  = str(self.geo_key).strip()
        api_map  = str(self.map_location).strip()

        # Check service
        if self.auth not in ['ptc', 'google']:
            self.__puts('error',"Invalid auth service %s" % ( self.auth ))
            sys.exit(-1)

        # Create PokoAuthObject
        poko_session = PokeAuthSession(
            api_user,
            api_pass,
            api_auth,
            geo_key=api_geo
        )

        if self.map_location:
            session = poko_session.authenticate(locationLookup=api_map)
        else:
            session = poko_session.authenticate()

        if session:
            # Trying not to flood the servers
            cooldown = 1

            # Run the bot
            while True:
                forts = self.__sortCloseForts(session)
                #self.__cleanPokemon(session, thresholdCP=300)
                #self.__cleanInventory(session)
                try:
                    for fort in forts:
                        pokemon = self.__findBestPokemon(session)
                        self.__walkAndCatch(session, pokemon)
                        self.__walkAndSpin(session, fort)
                        cooldown = 1
                        time.sleep(1)

                # Catch problems and reauthenticate
                except GeneralPogoException as e:
                    self.__puts('error',"GeneralPogoException raised: %s" % e)
                    session = poko_session.reauthenticate(session)
                    time.sleep(cooldown)
                    cooldown *= 2

                except Exception as e:
                    self.__puts('error',"Exception raised: %s" % e)
                    session = poko_session.reauthenticate(session)
                    time.sleep(cooldown)
                    cooldown *= 2
コード例 #3
0
def login_data():
    if request.json:
        mydata = request.json
        username = mydata.get("username")
        password = mydata.get("password")
        auth = mydata.get("auth")
        location = mydata.get("location")

        if username == None or password == None or auth == None or location == None:
            return jsonify(error="missing value"), 400

        poko_session = PokeAuthSession(
            username,
            password,
            auth,
            geo_key=None
        )

        session = poko_session.authenticate(locationLookup=location)

        if session:
            global sessions
            global users
            sessions[username] = session
            users.append(username)
            logging.info(users)

            return jsonify(data=str(session))
        else:
            return jsonify(error=str(session)), 400

    else:
        return jsonify(error="no values receives"), 400
コード例 #4
0
def login(auth_type, user, password, location):
    """
    Access Token: eyJhbGciOiJSUzI1NiIsImtpZCI6ImE5NzAyMjQ0YWE3YjMyYT
        BjZjM4MWNjNjVhZDk4OGYyMzllYmIzOWYifQ.eyJpc3MiOiJhY2NvdW50cy5
        nb29nbGUuY29tIiwiYXVkIjoiODQ4MjMyNTExMjQwLTdzbzQyMWpvdHIyNjA
        5cm1xYWtjZXV1MWx1dXEwcHRiLmFwcHMuZ29vZ2xldXNlcmNvbnRlbnQuY29
        tIiwic3ViIjoiMTExNjc4NjkwMjc5NTg4MzQ5MTIxIiwiZW1haWxfdmVyaWZ
        pZWQiOnRydWUsImF6cCI6Ijg0ODIzMjUxMTI0MC0zdmRydHJmZG50bGpmMnU
        0bWxndG5ubGhuaWduMzVkNS5hcHBzLmdvb2dsZXVzZXJjb250ZW50LmNvbSI
        sImVtYWlsIjoiam04bmF2QGdtYWlsLmNvbSIsImlhdCI6MTQ2OTcwODM2NCw
        iZXhwIjoxNDY5NzExOTY0LCJuYW1lIjoiSm9zZSBNaWd1ZWwgTmF2YXJybyB
        JZ2xlc2lhcyIsInBpY3R1cmUiOiJodHRwczovL2xoMy5nb29nbGV1c2VyY29
        udGVudC5jb20vLVh1Zzk3b2F2TXljL0FBQUFBQUFBQUFJL0FBQUFBQUFBVTh
        ZL2lkc0VneDBkU0tFL3M5Ni1jL3Bob3RvLmpwZyIsImdpdmVuX25hbWUiOiJ
        Kb3NlIE1pZ3VlbCIsImZhbWlseV9uYW1lIjoiTmF2YXJybyBJZ2xlc2lhcyJ
        9.i4ku4mRx2u1qKkfE7bZRRd2UZpywFRLwJkTSHhNIPpNSqLoICWhY8ULeIJ
        chCmBfWlunyKbFhOGKEy3tnByReR5WxbIv5BVhh5W5Jo75kCScr-nfMlXDew
        Kq3WzwQNxwHk-5bOIpFFtGRdtmsmPEB4zHZPbTHxh44metWY5LgYsMF9eeDY
        OHyLkb3hxyZEjYlnKm4Sz9lutpgun61ZujPdHpN-A_VY01QdLgPMfHo18qfE
        9d-uOhHj32hQGwVRyVWSwXRXhSj-vAAPccNYYbWTTov5ZWin2qyo7DhH1lui
        7qzwZVGm06hQQQHJrTR81v1PU9lBClVps9s0NYr87_lQ 
    Endpoint: https://pgorelease.nianticlabs.com/plfe/528/rpc 
    Location: 
        Coordinates: 
            50.8503396 4.3517103 0.0
    """

    poko_session = PokeAuthSession(
        user,
        password,
        auth_type,
        geo_key=None
    )

    session = poko_session.authenticate(locationLookup=location)

    if session:
        global sessions
        global users
        sessions[user] = session
        users.append(user)
        logging.info(users)

        #access_token = getattr(session, "access_token", None)
        #endpoint = getattr(session, "Endpoint", None)
        #location = getattr(session, "Location", None)
        #if access_token != None and endpoint != None and location != None:
        #    return jsonify(access_token=access_token, endpoint=endpoint, location=location)
    #else:
    #    return jsonify(session), 400
    return str(session)
コード例 #5
0
ファイル: pokeIV-gui.py プロジェクト: Critting/calc-transfer
def main():
    setupLogger()
    logging.debug('Logger set up')

    config = init_config()
    if not config:
        return

    # Create PokoAuthObject
    poko_session = PokeAuthSession(
        config["username"],
        config["password"],
        config["auth_service"],
        geo_key=""
    )
    
    # Authenticate with a given location
    # Location is not inherent in authentication
    # But is important to session
    session = poko_session.authenticate(config["location"])
    
    # Time to show off what we can do
    if not session:
        logging.critical('Session not created successfully')
        return
    
    #get inventory
    inventory = session.getInventory()
    pokemon = inventory["party"]
    candy = inventory["candies"]
    
    # -- dictionaries for pokedex, families, and evolution prices
    with open('names.tsv') as f:
        f.readline()
        pokedex = dict(csv.reader(f, delimiter='\t'))
        
    with open('families.tsv') as f:
        f.readline()
        family = dict(csv.reader(f, delimiter='\t'))    
        
    with open('evolves.tsv') as f:
        f.readline()
        cost = dict(csv.reader(f, delimiter='\t'))
    
    data = PokemonData(pokemon, candy, pokedex, family, cost, config, session)
       
    main_window = tk.Tk()
    app = PokeIVWindow(config,data,session,master=main_window)
    app.mainloop()
コード例 #6
0
ファイル: list_pokemon.py プロジェクト: luzi82/PokeManager
    if args.sort not in ['recent','iv','number']:
        logging.error('Invalid sort {}'.format(args.sort))
        sys.exit(-1)

    # Check password
    if args.password == None:
        args.password = getpass.getpass()

    # 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(args.location)
    else:
        session = poko_session.authenticate()

    # Time to show off what we can do
    if session:
        viewPokemon(session,args.sort)
    else:
        logging.critical('Session not created successfully')
        sys.exit(-1)
コード例 #7
0
ファイル: demo.py プロジェクト: kronicd/pokemongo-api
    if args.speed:
        speed = int(args.speed)
    while True:
        try:
            # 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:
                camBot(session, speed)

            else:
                logging.critical('Session not created successfully')
        except Exception as e:
            logging.critical("Something tried to shut us down, logging in again after 20 secs")
            logging.critical(e)
            time.sleep(20)  # pretty sure this is in seconds
コード例 #8
0
    #os.remove("info.txt")

    print("Authorization Type Detected: ", auth_type)

    # Create PokoAuthObject
    poko_session = PokeAuthSession(
        username,
        password,
        auth_type,
        geo_key=None
    )

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



    # Authenticate with a given location
    # Location is not inherent in authentication
    # But is important to session

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

        # General

        logging.info(args.uuid)

        uuid = args.uuid
コード例 #9
0
ファイル: demo.py プロジェクト: rllin/pogobo
        geo_key=args.geo_key
    )
    '''
    poko_session = PokeAuthSession(
    )

    # Authenticate with a given location
    # Location is not inherent in authentication
    # But is important to session
    #session = poko_session.authenticate(args.location)
    #session = poko_session.authenticate('San Francisco, CA')
    #session = poko_session.authenticate('480 Potrero Ave. San Francisco, CA')
    #session = poko_session.authenticate('250 King St. San Francisco, CA')
    #session = poko_session.authenticate('4th St. and Market St. San Francisco, CA')
    #session = poko_session.authenticate('735 Market St. San Francisco, CA')
    session = poko_session.authenticate('Union Square, San Francisco, CA')


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

        # General
        getProfile(session)
        getInventory(session)

        # Pokemon related
        #pokemon = findClosestPokemon(session)
        #walkAndCatch(session, pokemon)

        # Pokestop related
        #fort = findClosestFort(session)
コード例 #10
0
ファイル: cleaner.py プロジェクト: saphid/pokemongocleaner
PARSER.add_argument("-l", "--live", help="WILL CHANGE!!!", action='store_true')
PARSER.add_argument("-v", "--verbose", help="Verbose", action='store_true')
ARGS = PARSER.parse_args()

if not ARGS.user:
    USER = raw_input('Username: '******'pkmg', USER)

if not PASS:
    PASS = getpass.getpass('Password: '******'pkmg', USER, PASS)

POKESESSION = PokeAuthSession(USER, PASS, 'google')
SESSION = POKESESSION.authenticate(locationLookup='50 Bridge St, Sydney')

INV = SESSION.getInventory()

# #POKES = sorted(INV.party, key=lambda x: x.cp, reverse=True)
POKES = sorted(INV.party, key=lambda x: x.pokemon_id, reverse=True)
# # POKES = sorted(
# #     INV.party,
# #     key=
# #     lambda x: (x.individual_attack + x.individual_defense + x.individual_stamina),
# #     reverse=True)

GELATO = {}

for poke in POKES:
    goodness = (poke.individual_attack + poke.individual_defense +
コード例 #11
0
        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
        getProfile(session)
        getInventory(session)

        # Things we need GPS for
        if args.location:
            # Pokemon related
            pokemon = findBestPokemon(session)
            walkAndCatch(session, pokemon)
コード例 #12
0
ファイル: mgr.py プロジェクト: DNA64/PokeyPyManager
    
    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'),
        ''.join(['encrypt/',config.get('CONFIG', 'encryptFile')]),
        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.")
    
    app.run(host='0.0.0.0', port=5100, debug=True)
    url_for('static', filename='catch_data.json')
    	
    
	
コード例 #13
0
ファイル: snipe.py プロジェクト: Iceybb/PokeyPySnipe
    # 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."
    )

    app.run(host='0.0.0.0', port=5100)
    url_for('static', filename='catch_data.json')
コード例 #14
0
ファイル: pokeIV.py プロジェクト: Critting/calc-transfer
def main():
    setupLogger()
    logging.debug('Logger set up')

    config = init_config()
    if not config:
        return

    # Create PokoAuthObject
    poko_session = PokeAuthSession(
        config.username,
        config.password,
        config.auth_service,
        geo_key=""
    )
    
    # Authenticate with a given location
    # Location is not inherent in authentication
    # But is important to session
    session = poko_session.authenticate(config.location)
    
    # Time to show off what we can do
    if not session:
        logging.critical('Session not created successfully')
        return
    
    #get inventory
    inventory = session.getInventory()
    pokemon = inventory["party"]
    candy = inventory["candies"]
    
    # -- dictionaries for pokedex, families, and evolution prices
    with open('names.tsv') as f:
        f.readline()
        pokedex = dict(csv.reader(f, delimiter='\t'))
        
    with open('families.tsv') as f:
        f.readline()
        family = dict(csv.reader(f, delimiter='\t'))    
        
    with open('evolves.tsv') as f:
        f.readline()
        cost = dict(csv.reader(f, delimiter='\t'))
    
    data = PokemonData(pokemon, candy, pokedex, family, cost, config)
    
    if len(data["all"]) == 0:
        print('You have no pokemon...')
        return
    
    #------- best pokemon
    if data["best"]:
        print_header('Highest IV Pokemon')
        print_pokemon(data["best"], data["config"].verbose)
    #------- transferable pokemon
    if data["transfer"]:
        print_header('May be transfered')
        print_pokemon(data["transfer"], data["config"].verbose)
    #------- extras that aren't to be transfered
    if data["other"]:
        print_header('Other Pokemon')
        print_pokemon(data["other"], data["config"].verbose)
    #------- evolve candidate  pokemon
    if data["evolve"]:
        print_evolve_candidates(data)
    #------- transfer extra pokemon
    if data["config"].transfer and data["transfer"]:
        transfer_pokemon(data, session)
    #------- evolving t1 pokemon
    if data["config"].evolve and data["evolve"]:
        evolve_pokemon(data, session)
コード例 #15
0
ファイル: main.py プロジェクト: aaaddress1/PykemonGo
    pasWord = parser.get('account', 'pas')
    loginType = parser.get('account', 'type')
    usrLocation = parser.get('account', 'location')
    # Create PokoAuthObject
    poko_session = PokeAuthSession(
        usrName,
        pasWord,
        loginType
    )


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

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

        # General
        getProfile(session)
        #getInventory(session)
        if usrLocation:
            simpleBot(session)


    else:
        logging.critical('Session not created successfully')
コード例 #16
0
                                   args.password,
                                   args.auth,
                                   geo_key=args.geo_key)

    print 'Authenticate with a given location'
    # Location is not inherent in authentication
    # But is important to session
    if MODENO == 3:
        args.location = "35.64387036252, 139.6820211410"
    elif MODENO == 4:
        args.location = "35.6717352739260, 139.764568805694"
    elif args.location == None:
        args.location = "35.6717352739260, 139.764568805694"

    #session start
    session = poko_session.authenticate(args.location)
    session_start_time = time.time()

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

        # General
        getProfile(session)
        time.sleep(2)
        getInventory(session)
        time.sleep(2)
        cleanInventory(session)
        time.sleep(2)
        setEgg(session)

        for i in range(ROUND):