当前位置: 首页>>代码示例>>Python>>正文


Python PokeAuthSession.authenticate方法代码示例

本文整理汇总了Python中api.PokeAuthSession.authenticate方法的典型用法代码示例。如果您正苦于以下问题:Python PokeAuthSession.authenticate方法的具体用法?Python PokeAuthSession.authenticate怎么用?Python PokeAuthSession.authenticate使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在api.PokeAuthSession的用法示例。


在下文中一共展示了PokeAuthSession.authenticate方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: __api_connect

# 需要导入模块: from api import PokeAuthSession [as 别名]
# 或者: from api.PokeAuthSession import authenticate [as 别名]
    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)
开发者ID:mikaelkall,项目名称:pokemon-bot,代码行数:33,代码来源:polib.py

示例2: __simpleBot2

# 需要导入模块: from api import PokeAuthSession [as 别名]
# 或者: from api.PokeAuthSession import authenticate [as 别名]
    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
开发者ID:mikaelkall,项目名称:pokemon-bot,代码行数:57,代码来源:polib.py

示例3: login_data

# 需要导入模块: from api import PokeAuthSession [as 别名]
# 或者: from api.PokeAuthSession import authenticate [as 别名]
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
开发者ID:josenavarro-famoco,项目名称:flask-pg,代码行数:35,代码来源:ext_api.py

示例4: login

# 需要导入模块: from api import PokeAuthSession [as 别名]
# 或者: from api.PokeAuthSession import authenticate [as 别名]
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)
开发者ID:josenavarro-famoco,项目名称:flask-pg,代码行数:53,代码来源:ext_api.py

示例5: main

# 需要导入模块: from api import PokeAuthSession [as 别名]
# 或者: from api.PokeAuthSession import authenticate [as 别名]
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()
开发者ID:Critting,项目名称:calc-transfer,代码行数:51,代码来源:pokeIV-gui.py

示例6: PokeAuthSession

# 需要导入模块: from api import PokeAuthSession [as 别名]
# 或者: from api.PokeAuthSession import authenticate [as 别名]
    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)
开发者ID:luzi82,项目名称:PokeManager,代码行数:32,代码来源:list_pokemon.py

示例7: int

# 需要导入模块: from api import PokeAuthSession [as 别名]
# 或者: from api.PokeAuthSession import authenticate [as 别名]
    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
开发者ID:kronicd,项目名称:pokemongo-api,代码行数:32,代码来源:demo.py

示例8: print

# 需要导入模块: from api import PokeAuthSession [as 别名]
# 或者: from api.PokeAuthSession import authenticate [as 别名]
    #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
开发者ID:noahc3,项目名称:PokemonGoTeamManager,代码行数:33,代码来源:release.py

示例9: PokeAuthSession

# 需要导入模块: from api import PokeAuthSession [as 别名]
# 或者: from api.PokeAuthSession import authenticate [as 别名]
        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)
开发者ID:rllin,项目名称:pogobo,代码行数:33,代码来源:demo.py

示例10: raw_input

# 需要导入模块: from api import PokeAuthSession [as 别名]
# 或者: from api.PokeAuthSession import authenticate [as 别名]
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: ')
else:
    USER = ARGS.user
PASS = keyring.get_password('pkmg', USER)

if not PASS:
    PASS = getpass.getpass('Password: ')
    keyring.set_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 +
开发者ID:saphid,项目名称:pokemongocleaner,代码行数:33,代码来源:cleaner.py

示例11: PokeAuthSession

# 需要导入模块: from api import PokeAuthSession [as 别名]
# 或者: from api.PokeAuthSession import authenticate [as 别名]
    
    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')
    	
    
	
开发者ID:DNA64,项目名称:PokeyPyManager,代码行数:29,代码来源:mgr.py

示例12: main

# 需要导入模块: from api import PokeAuthSession [as 别名]
# 或者: from api.PokeAuthSession import authenticate [as 别名]
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)
开发者ID:Critting,项目名称:calc-transfer,代码行数:73,代码来源:pokeIV.py

示例13: PokeAuthSession

# 需要导入模块: from api import PokeAuthSession [as 别名]
# 或者: from api.PokeAuthSession import authenticate [as 别名]
    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')
开发者ID:aaaddress1,项目名称:PykemonGo,代码行数:33,代码来源:main.py


注:本文中的api.PokeAuthSession.authenticate方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。