MCPcopy Create free account
hub / github.com/RocketMap/RocketMap / check_login

Function check_login

pogom/search.py:583–611  ·  view source on GitHub ↗
(args, account, api, position, proxy_url)

Source from the content-addressed store, hash-verified

581
582
583def check_login(args, account, api, position, proxy_url):
584
585 # Logged in? Enough time left? Cool!
586 if api._auth_provider and api._auth_provider._ticket_expire:
587 remaining_time = api._auth_provider._ticket_expire / 1000 - time.time()
588 if remaining_time > 60:
589 log.debug('Credentials remain valid for another %f seconds', remaining_time)
590 return
591
592 # Try to login (a few times, but don't get stuck here)
593 i = 0
594 api.set_position(position[0], position[1], position[2])
595 while i < args.login_retries:
596 try:
597 if proxy_url:
598 api.set_authentication(provider=account['auth_service'], username=account['username'], password=account['password'], proxy_config={'http': proxy_url, 'https': proxy_url})
599 else:
600 api.set_authentication(provider=account['auth_service'], username=account['username'], password=account['password'])
601 break
602 except AuthException:
603 if i >= args.login_retries:
604 raise TooManyLoginAttempts('Exceeded login attempts')
605 else:
606 i += 1
607 log.error('Failed to login to Pokemon Go with account %s. Trying again in %g seconds', account['username'], args.login_delay)
608 time.sleep(args.login_delay)
609
610 log.debug('Login for account %s successful', account['username'])
611 time.sleep(args.scan_delay)
612
613
614def map_request(api, position, jitter=False):

Callers 1

search_worker_threadFunction · 0.85

Calls 3

set_positionMethod · 0.80
set_authenticationMethod · 0.80

Tested by

no test coverage detected