File tree Expand file tree Collapse file tree
packages/google-api-core/google/api_core Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -138,10 +138,12 @@ def get_default_mtls_endpoint(api_endpoint: Optional[str]) -> Optional[str]:
138138 port = f":{ parsed .port } " if parsed .port else ""
139139
140140 lowered_host = host .lower ()
141- if lowered_host .endswith (".sandbox.googleapis.com" ):
142- new_host = host [:- 23 ] + ".mtls.sandbox.googleapis.com"
143- elif lowered_host .endswith (".googleapis.com" ):
144- new_host = host [:- 15 ] + ".mtls.googleapis.com"
141+ suffix_sandbox = ".sandbox.googleapis.com"
142+ suffix_google = ".googleapis.com"
143+ if lowered_host .endswith (suffix_sandbox ):
144+ new_host = host [:- len (suffix_sandbox )] + ".mtls.sandbox.googleapis.com"
145+ elif lowered_host .endswith (suffix_google ):
146+ new_host = host [:- len (suffix_google )] + ".mtls.googleapis.com"
145147 else :
146148 return api_endpoint
147149
You can’t perform that action at this time.
0 commit comments