def initialize(ee_account='', ee_key_path='', ee_user_token=''):
try:
if ee_user_token:
credentials = OAuth2Credentials(ee_user_token, None, None, None, None, None, None)
ee.InitializeThread(credentials)
elif ee_account and ee_key_path:
credentials = ServiceAccountCredentials.from_p12_keyfile(
service_account_email=ee_account,
filename=ee_key_path,
private_key_password='notasecret',
scopes=ee.oauth.SCOPE + ' https://www.googleapis.com/auth/drive')
ee.Initialize(credentials)
else:
ee.Initialize()
except (EEException, TypeError):
pass
评论列表
文章目录