本文整理汇总了Python中gpsoauth.perform_oauth方法的典型用法代码示例。如果您正苦于以下问题:Python gpsoauth.perform_oauth方法的具体用法?Python gpsoauth.perform_oauth怎么用?Python gpsoauth.perform_oauth使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类gpsoauth
的用法示例。
在下文中一共展示了gpsoauth.perform_oauth方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: login
# 需要导入模块: import gpsoauth [as 别名]
# 或者: from gpsoauth import perform_oauth [as 别名]
def login(self, username, password):
self.log.info('Google login for: {}'.format(username))
login = perform_master_login(username, password, self.GOOGLE_LOGIN_ANDROID_ID)
login = perform_oauth(username, login.get('Token', ''), self.GOOGLE_LOGIN_ANDROID_ID, self.GOOGLE_LOGIN_SERVICE, self.GOOGLE_LOGIN_APP,
self.GOOGLE_LOGIN_CLIENT_SIG)
self._auth_token = login.get('Auth')
if self._auth_token is None:
self.log.info('Google Login failed.')
return False
self._login = True
self.log.info('Google Login successful.')
self.log.debug('Google Session Token: %s', self._auth_token[:25])
return True
示例2: createGoogleSession
# 需要导入模块: import gpsoauth [as 别名]
# 或者: from gpsoauth import perform_oauth [as 别名]
def createGoogleSession(self, locationLookup='', session=None, noop=False):
logging.info('Creating Google session for %s', self.username)
r1 = perform_master_login(self.username, self.password, ANDROID_ID)
r2 = perform_oauth(
self.username,
r1.get('Token', ''),
ANDROID_ID,
SERVICE,
APP,
CLIENT_SIG
)
self.access_token = r2.get('Auth') # access token
return self.createPogoSession(
provider='google',
locationLookup=locationLookup,
session=session,
noop=noop
)
示例3: login_google
# 需要导入模块: import gpsoauth [as 别名]
# 或者: from gpsoauth import perform_oauth [as 别名]
def login_google(account):
ANDROID_ID = '9774d56d682e549c'
SERVICE = 'audience:server:client_id:848232511240-7so421jotr2609rmqakceuu1luuq0ptb.apps.googleusercontent.com'
APP = 'com.nianticlabs.pokemongo'
APP_SIG = '321187995bc7cdc2b5fc91b11a96e2baa8602c62'
while True:
try:
login1 = perform_master_login(account['user'], account['pw'], ANDROID_ID)
while login1.get('Token') is None:
lprint('[{}] Google Login error, retrying... (step 1)'.format(account['num']))
time.sleep(2)
login1 = perform_master_login(account['user'], account['pw'], ANDROID_ID)
login2 = perform_oauth(account['user'], login1.get('Token'), ANDROID_ID, SERVICE, APP, APP_SIG)
while login2.get('Auth') is None:
lprint('[{}] Google Login error, retrying... (step 2)'.format(account['num']))
time.sleep(2)
login2 = perform_oauth(account['user'], login1.get('Token', ''), ANDROID_ID, SERVICE, APP, APP_SIG)
access_token = login2['Auth']
account['access_expire_timestamp'] = 7200000 - 30000 + get_time() #int(login2['Expiry'])*1000
account['access_token'] = access_token
return
except Exception as e:
lprint('[{}] Unexpected google login error: {}'.format(account['num'], e))
lprint('[{}] Retrying...'.format(account['num']))
time.sleep(1)
示例4: get_access_token
# 需要导入模块: import gpsoauth [as 别名]
# 或者: from gpsoauth import perform_oauth [as 别名]
def get_access_token(self, force_refresh=False):
token_validity = self.check_access_token()
if token_validity is True and force_refresh is False:
self.log.debug('Using cached Google Access Token')
return self._access_token
else:
if force_refresh:
self.log.info('Forced request of Google Access Token!')
else:
self.log.info('Request Google Access Token...')
token_data = perform_oauth(None, self._refresh_token, self.GOOGLE_LOGIN_ANDROID_ID, self.GOOGLE_LOGIN_SERVICE, self.GOOGLE_LOGIN_APP,
self.GOOGLE_LOGIN_CLIENT_SIG)
access_token = token_data.get('Auth', None)
if access_token is not None:
self._access_token = access_token
self._access_token_expiry = int(token_data.get('Expiry', 0))
self._login = True
self.log.info('Google Access Token successfully received.')
self.log.debug('Google Access Token: %s...', self._access_token[:25])
return self._access_token
else:
self._access_token = None
self._login = False
raise AuthException("Could not receive a Google Access Token")
示例5: login_google
# 需要导入模块: import gpsoauth [as 别名]
# 或者: from gpsoauth import perform_oauth [as 别名]
def login_google(username, password):
print '[!] Google login for: {}'.format(username)
r1 = perform_master_login(username, password, ANDROID_ID)
r2 = perform_oauth(username,
r1.get('Token', ''),
ANDROID_ID,
SERVICE,
APP,
CLIENT_SIG, )
return r2.get('Auth')
示例6: get_access_token
# 需要导入模块: import gpsoauth [as 别名]
# 或者: from gpsoauth import perform_oauth [as 别名]
def get_access_token(self, force_refresh = False):
token_validity = self.check_access_token()
if token_validity is True and force_refresh is False:
self.log.debug('Using cached Google Access Token')
return self._access_token
else:
if force_refresh:
self.log.info('Forced request of Google Access Token!')
else:
self.log.info('Request Google Access Token...')
token_data = perform_oauth(None, self._refresh_token, self.GOOGLE_LOGIN_ANDROID_ID, self.GOOGLE_LOGIN_SERVICE, self.GOOGLE_LOGIN_APP,
self.GOOGLE_LOGIN_CLIENT_SIG)
access_token = token_data.get('Auth', None)
if access_token is not None:
self._access_token = access_token
self._access_token_expiry = int(token_data.get('Expiry', 0))
self._login = True
self.log.info('Google Access Token successfully received.')
self.log.debug('Google Access Token: %s...', self._access_token[:25])
else:
self._access_token = None
self._login = False
raise AuthException("Could not receive a Google Access Token")
示例7: login_google
# 需要导入模块: import gpsoauth [as 别名]
# 或者: from gpsoauth import perform_oauth [as 别名]
def login_google(username, password):
print('[!] Google login for: {}'.format(username))
r1 = perform_master_login(username, password, ANDROID_ID)
r2 = perform_oauth(username, r1.get('Token', ''), ANDROID_ID, SERVICE, APP,
CLIENT_SIG)
return r2.get('Auth') # access token
示例8: get_access_token
# 需要导入模块: import gpsoauth [as 别名]
# 或者: from gpsoauth import perform_oauth [as 别名]
def get_access_token(self, username, password):
r1 = perform_master_login(username, password, ANDROID_ID)
r2 = perform_oauth(username, r1.get('Token', ''), ANDROID_ID, SERVICE, APP, CLIENT_SIG)
return r2.get('Auth')