Example #1
0
    def __init__(self):

        self.initialize = ee.Initialize()
        self.credentials = ee.Credentials()
        self.service = discovery.build(serviceName='drive',
                                       version='v3',
                                       cache_discovery=False,
                                       credentials=self.credentials)
Example #2
0
def get_credentials():
    credentials = ee.Credentials()
    if type(credentials) == ThreadLocalCredentials:
        credentials = credentials.get()
    if not credentials:
        raise Exception(
            'ee.InitializeThread() has not been called for current thread.')
    return credentials
Example #3
0
def _first_asset_root():
    asset_roots = ee.data.getAssetRoots()
    if not asset_roots:
        raise Exception('User has no GEE asset roots: {}'.format(
            ee.Credentials()))
    return asset_roots[0]['id']
Example #4
0
def _first_asset_root():
    asset_roots = [bucket['id'] for bucket in ee.data.listBuckets()['assets']]
    if not asset_roots:
        raise Exception('User has no GEE asset roots: {}'.format(
            ee.Credentials()))
    return asset_roots[0]