Skip to content
This repository was archived by the owner on Sep 20, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -148,15 +148,7 @@ def _get_scopes_kwargs(
packaging.version.parse(_GOOGLE_AUTH_VERSION)
>= packaging.version.parse("1.25.0")
):
# Documentai uses a regional host (us-documentai.googleapis.com) as the default
# so self-signed JWT cannot be used.
# Intentionally pass default scopes as user scopes so the auth library
# does not use the self-signed JWT flow.
# https://github.com/googleapis/python-documentai/issues/174
scopes_kwargs = {
"scopes": scopes or cls.AUTH_SCOPES,
"default_scopes": cls.AUTH_SCOPES,
}
scopes_kwargs = {"scopes": scopes, "default_scopes": cls.AUTH_SCOPES}
else:
scopes_kwargs = {"scopes": scopes or cls.AUTH_SCOPES}

Expand Down
23 changes: 0 additions & 23 deletions owlbot.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,34 +30,11 @@
for library in s.get_staging_dirs(default_version):
excludes = [
"README.rst",
"nox.py",
"docs/index.rst",
"setup.py",
"scripts/fixup_documentai_v*", # this library was always generated with the microgenerator
]

s.replace(library / "google/cloud/documentai_v1beta2/**/base.py",
"""scopes_kwargs = \{"scopes": scopes, "default_scopes": cls\.AUTH_SCOPES\}""",
"""# Documentai uses a regional host (us-documentai.googleapis.com) as the default
# so self-signed JWT cannot be used.
# Intentionally pass default scopes as user scopes so the auth library
# does not use the self-signed JWT flow.
# https://github.com/googleapis/python-documentai/issues/174
scopes_kwargs = {"scopes": scopes or cls.AUTH_SCOPES, "default_scopes": cls.AUTH_SCOPES}""")

s.replace(library / "tests/**/documentai_v1beta2/*.py",
"""(@requires_google_auth_gte_1_25_0
def test_document_.*?_service_base_transport_with_credentials_file.*?)scopes=None,""",
"""\g<1>scopes=("https://www.googleapis.com/auth/cloud-platform",),""",
flags=re.MULTILINE | re.DOTALL,
)

s.replace(library / "tests/**/documentai_v1beta2/*.py",
"""(@requires_google_auth_gte_1_25_0
def test_document_.*?_service_auth_adc.*?)scopes=None,""",
"""\g<1>scopes=("https://www.googleapis.com/auth/cloud-platform",),""",
flags=re.MULTILINE | re.DOTALL,
)
s.move(library, excludes=excludes)

s.remove_staging_dirs()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1045,7 +1045,7 @@ def test_document_understanding_service_base_transport_with_credentials_file():
)
load_creds.assert_called_once_with(
"credentials.json",
scopes=("https://www.googleapis.com/auth/cloud-platform",),
scopes=None,
default_scopes=("https://www.googleapis.com/auth/cloud-platform",),
quota_project_id="octopus",
)
Expand Down Expand Up @@ -1089,7 +1089,7 @@ def test_document_understanding_service_auth_adc():
adc.return_value = (ga_credentials.AnonymousCredentials(), None)
DocumentUnderstandingServiceClient()
adc.assert_called_once_with(
scopes=("https://www.googleapis.com/auth/cloud-platform",),
scopes=None,
default_scopes=("https://www.googleapis.com/auth/cloud-platform",),
quota_project_id=None,
)
Expand Down