Skip to content

Commit

Permalink
Create ee-test-with-oauth2.py
Browse files Browse the repository at this point in the history
  • Loading branch information
jdbcode authored Oct 15, 2024
1 parent 0a76709 commit 56760a3
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions ee-test-with-oauth2.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import ee
import json
import os
import google.oauth2.credentials

stored = json.loads(os.getenv("EARTHENGINE_TOKEN"))
credentials = google.oauth2.credentials.Credentials(
None,
token_uri="https://oauth2.googleapis.com/token",
client_id=stored["client_id"],
client_secret=stored["client_secret"],
refresh_token=stored["refresh_token"],
quota_project_id=stored["project"],
)

ee.Initialize(credentials=credentials)

print(ee.String("Greetings from the Earth Engine servers!").getInfo())

0 comments on commit 56760a3

Please sign in to comment.