本文整理汇总了Python中api.PokeAuthSession类的典型用法代码示例。如果您正苦于以下问题:Python PokeAuthSession类的具体用法?Python PokeAuthSession怎么用?Python PokeAuthSession使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了PokeAuthSession类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: login_data
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
示例2: __api_connect
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)
示例3: __simpleBot2
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
示例4: login
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: main
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: PokeAuthSession
if args.sort == '':
args.sort = 'recent'
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:
示例7: int
parser.add_argument("-g", "--geo_key", help="GEO API Secret")
parser.add_argument("-s", "--speed", help="Speed")
args = parser.parse_args()
# Check service
if args.auth not in ['ptc', 'google']:
logging.error('Invalid auth service {}'.format(args.auth))
sys.exit(-1)
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)
示例8: open
info = open("info.txt", "r+")
info_lines = info.readlines()
username = info_lines[0].strip('\n')
password = info_lines[1].strip('\n')
auth_type = info_lines[2].strip('\n')
info.close()
info_lines = ['sneaky bugger you are']
#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
示例9: PokeAuthSession
# 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
)
'''
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:
示例10: raw_input
PARSER.add_argument("-e", "--evolve", help="Evolvable", action='store_true')
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:
示例11: PokeAuthSession
#config.get('AUTH','username')
#config.get('AUTH','password')
#config.get('CONFIG','startLoc')
# Check service
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.")
示例12: sortCloseForts
elif option == 4:
suboption = 0
forts = sortCloseForts(session)
while suboption > -1:
i = 0
for fort in forts:
print ( "[" + str(i) + "]" + str(fort))
i = i + 1
print('[ -1 ]: Back')
suboption = input("Walk to fort? ")
if suboption != -1:
print walkAndSpin(session, forts[suboption])
forts.remove(fort)
# Entry point
# Start off authentication and demo
if __name__ == '__main__':
setupLogger()
logging.debug('Logger set up')
token = 'eyJhbGciOiJSUzI1NiIsImtpZCI6IjM5NGNiYjk4OTdmOGZiMmYzMzY0NTMzMmEyMTU0MDk5YTk1ZTI1OWYifQ.eyJpc3MiOiJhY2NvdW50cy5nb29nbGUuY29tIiwiYXVkIjoiODQ4MjMyNTExMjQwLTdzbzQyMWpvdHIyNjA5cm1xYWtjZXV1MWx1dXEwcHRiLmFwcHMuZ29vZ2xldXNlcmNvbnRlbnQuY29tIiwic3ViIjoiMTExNjc4NjkwMjc5NTg4MzQ5MTIxIiwiZW1haWxfdmVyaWZpZWQiOnRydWUsImF6cCI6Ijg0ODIzMjUxMTI0MC0zdmRydHJmZG50bGpmMnU0bWxndG5ubGhuaWduMzVkNS5hcHBzLmdvb2dsZXVzZXJjb250ZW50LmNvbSIsImVtYWlsIjoiam04bmF2QGdtYWlsLmNvbSIsImlhdCI6MTQ2OTkxNzkxNiwiZXhwIjoxNDY5OTIxNTE2LCJuYW1lIjoiSm9zZSBNaWd1ZWwgTmF2YXJybyBJZ2xlc2lhcyIsInBpY3R1cmUiOiJodHRwczovL2xoMy5nb29nbGV1c2VyY29udGVudC5jb20vLVh1Zzk3b2F2TXljL0FBQUFBQUFBQUFJL0FBQUFBQUFBVThZL2lkc0VneDBkU0tFL3M5Ni1jL3Bob3RvLmpwZyIsImdpdmVuX25hbWUiOiJKb3NlIE1pZ3VlbCIsImZhbWlseV9uYW1lIjoiTmF2YXJybyBJZ2xlc2lhcyJ9.d1W12odZnEScMvDGD643P9uIQ3IuycMmZFDwHKm1I8ILKYgz2bKUro_D47qer3muZajTXuehJ32Hjel3MPbb5H_DoOyO1AkzROHy6_EdxxBR_uM5jkMWUtFc1FRguZ8T47sFMR0-1ckCdP6S3ymvBiMkMA8rXj5QHljcT8tsMEf2HQ5iABYUYZ-gpmBwGEebTwzsBQQaN_m9JXe1nWoQcsC33unaLVOHUekRF7p3q8HyX-TDwPaDeMmgrEJR5dEFQjjthNyaJOo1AbkW-5guFrYvHAkdrwS8eHJS_LxZh0z902SRQR-cA8WBZRxkkZA0EvqGITniich12xG6ABVRGA'
location = Location('Brussels', None)
req_session = PokeAuthSession.createRequestsSession()
session = PogoSession(req_session, 'google', token, location)
if session:
manual(session)
else:
logging.critical('Session not created successfully')
sys.exit(-1)
示例13: main
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)
示例14: setupLogger
# Start off authentication and demo
if __name__ == '__main__':
setupLogger()
logging.debug('Logger set up')
parser = SafeConfigParser()
parser.read('data.config')
usrName = parser.get('account', 'usr')
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: