Skip to main content
Tests PyPI version Python versions Conda-Forge version License

The Earth Engine Session Client is a Python package that extends the Google Earth Engine (GEE) API by introducing multi-user session management through custom authentication.

Why This Package?

While Google Earth Engine applications can be created using a global service account, this approach has significant limitations: users cannot access their private GEE assets without making them public. This package solves this problem by handling custom authentication, allowing each user to access their own private assets securely.

Unlike the standard GEE API—which relies on a global session object and does not support multi-user environments—this client ensures that each session is authenticated and managed independently with user-specific credentials.

Each session is instantiated via the EESession class, which supports several credential sources — a service-account key, an EARTHENGINE_TOKEN environment variable, earthengine authenticate OAuth credentials, or Application Default Credentials. Once authenticated, the session exposes an operations property that provides easy access to key API methods.

Key Features

  • Custom User Authentication: Enable users to access their private GEE assets without requiring them to be public, solving the limitation of global service account approaches.

  • Multi-User Session Management: Encapsulate user-specific credentials and project data in independent EESession objects.

  • Enhanced API Operations: Access GEE functionalities via the operations property, which includes methods such as: - get_info: Retrieve detailed information about an Earth Engine object. - get_map_id: Generate a map ID for an Earth Engine image. - get_asset: Fetch information about a specific Earth Engine asset.

  • Seamless GEE Integration: Integrate custom methods into your existing Earth Engine workflow with minimal changes.

Installation

To install the package, simply use pip:

pip install ee-client

Usage

Initialization and Authentication

A session can be built from any standard Google/Earth Engine credential via factory constructors, each holding a live, refreshable credential:

from eeclient import EESession

# Service-account key (dict or path)
session = EESession.from_service_account("sa-key.json")

# EARTHENGINE_TOKEN env var, else ~/.config/earthengine/credentials
session = EESession.from_earthengine_token()

# An existing google.auth Credentials object
session = EESession.from_google_credentials(creds, project="my-project")

# Application Default Credentials (explicit opt-in)
session = EESession.from_application_default()

# Resolve from the environment (opt-in): EARTHENGINE_TOKEN / EE OAuth file
session = EESession.from_default()

Credentials are never resolved implicitly — a bare EESession() constructor call is not supported; always use a from_* factory to build a session. To resolve from the environment explicitly, call EESession.from_default(), which walks local sources only, in this order:

  1. EARTHENGINE_TOKEN environment variable

  2. Earth Engine credentials file (~/.config/earthengine/credentials)

The credentials file is accepted only when it holds an OAuth refresh token — the file earthengine authenticate writes. A service-account key at that path is refused with ServiceAccountFileRefusedError: it is a machine-wide identity, so resolving it implicitly would give every caller on the host the same Earth Engine account. To use it anyway, opt in explicitly:

session = EESession.from_default(allow_service_account_file=True)

Prefer EESession.from_service_account("sa-key.json"), which names the key you mean. Any other file shape — unparsable, or without a refresh token — raises CredentialsFileUnrecognizedError. Both errors subclass CredentialsResolutionError, so a single except covers every way from_default() can fail to resolve.

Application Default Credentials are not included — call EESession.from_application_default() to use them.

To see which source a session ended up using, inspect session.auth_mode (the credential kind: file/oauth/service_account/adc/sepal) and session.auth_source (the precise origin: earthengine_token/ee_oauth_file/ee_service_account_file/service_account/application_default/google_credentials/sepal_file/sepal_session).

Making API Calls

After initializing the session, use the operations property to access the key GEE methods. For example, you can retrieve information about Earth Engine objects, generate map IDs, or fetch asset details:

import ee

# Initialize the Earth Engine library (this can use any authentication method/account)
# The purpose of this is to ensure the ee library is available for use
ee.Initialize()

# Use the operations available in the session
result_info = session.operations.get_info(ee.Number(5))
print(result_info) # the GEE server call is done using the custom EE client

# Example: Generate a map ID for an Earth Engine image
image = ee.Image('COPERNICUS/S2/20190726T104031_20190726T104035_T31TGL')
map_id = session.operations.get_map_id(image)
print(map_id)

# Example: Retrieve asset information
asset_info = session.operations.get_asset("users/your_username/your_asset")
print(asset_info)

Contributing

We welcome contributions from the community. If you wish to help improve this package, please submit issues or pull requests.

Forking and Branching

  1. Fork the repository.

  2. Create a new branch:

    git checkout -b feature-branch
  3. Commit your changes:

    git commit -am 'Add new feature'
  4. Push the branch:

    git push origin feature-branch
  5. Create a new Pull Request.

License

This project is licensed under the MIT License. See the LICENSE file for details.

Release files for ee-client 3.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ee-client 3.1.1
File Size Uploaded
ee_client-3.1.1.tar.gz 49.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for ee-client 3.1.1
File Interpreter ABI Platform
ee_client-3.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 89.6 kB

Release files / ee_client-3.1.1.tar.gz

Download URL ee_client-3.1.1.tar.gz
Size 49.2 kB
Tags Source
SHA-256 checksum
How to use checksums
752a9890fde0d9bd562d38b5dd0cb9f12856f2ed9c75551e52400e9644e6e262
BLAKE2b-256 checksum
How to use checksums
fc28efd453852c5140b5165f8df4539f5cba7ae48f196e41e7813b3843e118ad
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 1, 2026.

Transparency log

Release files / ee_client-3.1.1-py3-none-any.whl

Download URL ee_client-3.1.1-py3-none-any.whl
Size 40.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
07445687652bffea3df4fc2753055a39cc74affc7ac8ad2eb70d776d1a50f69b
BLAKE2b-256 checksum
How to use checksums
0ebe98c8bbb221c77ede444a4dabd65493d61e400bd259f4bea69c5fb2a48798
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 1, 2026.

Transparency log

Release history Release notifications | RSS feed

3.2.1

2 release files

3.2.0

2 release files

3.1.2

2 release files

This release

3.1.1 This release

2 release files

3.1.0

2 release files

3.0.0

2 release files

2.6.3

2 release files

2.6.2

2 release files

2.6.1

2 release files

2.6.0

2 release files

2.5.2

2 release files

2.5.1

2 release files

2.5.0

2 release files

2.4.0

2 release files

2.3.0

2 release files

2.2.1

2 release files

2.2.0

2 release files

2.1.0

2 release files

2.0.3

2 release files

2.0.1

2 release files

1.6.0

2 release files

1.5.0

2 release files

1.4.0

2 release files

1.3.0

2 release files

1.2.2

2 release files

1.2.1

2 release files

1.2.0

2 release files

1.1.1

2 release files

1.1.0

2 release files

1.0.0

2 release files

0.7.0

2 release files

0.6.1

2 release files

0.6.0

2 release files

0.5.1

2 release files

0.5.0

2 release files

0.4.1

2 release files

0.4.0

2 release files

0.3.0

2 release files

0.1.0

2 release files

0.0.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page