Skip to content

Commit 2b34498

Browse files
committed
Add additional scopes to default logins
1 parent 7a10964 commit 2b34498

2 files changed

Lines changed: 12 additions & 3 deletions

File tree

dataplex-quickstart-labs/00-resources/scripts/python/business-glossary-import/dataplex-glossary/import/glossary-import.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -617,7 +617,10 @@ def create_dataplex_metadata_job(
617617
glossary_name
618618
):
619619
try:
620-
credentials, _ = google.auth.default()
620+
credentials, _ = google.auth.default(scopes=[
621+
'https://www.googleapis.com/auth/cloud-platform',
622+
'https://www.googleapis.com/auth/spreadsheets'
623+
])
621624
service = build('dataplex', 'v1', credentials=credentials)
622625
parent = f"projects/{project_id}/locations/{location_id}"
623626
metadata_job_body = {
@@ -654,7 +657,10 @@ def create_dataplex_metadata_job(
654657

655658
def poll_operation(operation_name, poll_interval=10, max_polls=60):
656659
"""Polls a Long Running Operation until it's done."""
657-
credentials, _ = google.auth.default()
660+
credentials, _ = google.auth.default(scopes=[
661+
'https://www.googleapis.com/auth/cloud-platform',
662+
'https://www.googleapis.com/auth/spreadsheets'
663+
])
658664
service = build('dataplex', 'v1', credentials=credentials)
659665
for i in range(max_polls):
660666
try:

dataplex-quickstart-labs/00-resources/scripts/python/business-glossary-import/dataplex-glossary/utils/dataplex_dao.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,10 @@
2020
def get_dataplex_service() -> Resource:
2121
"""Returns an authenticated Dataplex service client."""
2222
logger.debug("Initializing Dataplex service client.")
23-
credentials, _ = google.auth.default()
23+
credentials, _ = google.auth.default(scopes=[
24+
'https://www.googleapis.com/auth/cloud-platform',
25+
'https://www.googleapis.com/auth/spreadsheets'
26+
])
2427
http_client = httplib2.Http(timeout=300)
2528
authorized_http = google_auth_httplib2.AuthorizedHttp(credentials, http=http_client)
2629
return build('dataplex', 'v1', http=authorized_http, cache_discovery=False)

0 commit comments

Comments
 (0)