Skip to content

Commit 63e678f

Browse files
fix: docstring update and remove unsed imports
Signed-off-by: Radhika Agrawal <agrawalradhika@google.com>
1 parent 2a0a71a commit 63e678f

File tree

4 files changed

+13
-18
lines changed

4 files changed

+13
-18
lines changed

google/auth/transport/_mtls_helper.py

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -409,20 +409,22 @@ def client_cert_callback():
409409

410410
def check_use_client_cert():
411411
"""Returns the value of the GOOGLE_API_USE_CLIENT_CERTIFICATE variable,
412-
or an inferred 'true' or 'false' value if unset.
412+
or an inferred value('true' or 'false') if unset.
413413
414-
The function checks the value of GOOGLE_API_USE_CLIENT_CERTIFICATE
415-
environment variable, and GOOGLE_API_CERTIFICATE_CONFIG environment variable
416-
if the former is not set. If GOOGLE_API_USE_CLIENT_CERTIFICATE is set,
417-
this helper function returns the value of the former. If it is unset, this
418-
helper function checks if GOOGLE_API_CERTIFICATE_CONFIG is set. If it is set,
419-
this helper function returns "true" if the certificate config file contains
420-
"workload" section and "false" otherwise.
414+
This value is meant to be interpreted as a "true" or "false" value
415+
representing whether the client certificate should be used, but could be any
416+
arbitrary string.
417+
418+
If GOOGLE_API_USE_CLIENT_CERTIFICATE is unset, the value value will be
419+
inferred by reading a file pointed at by GOOGLE_API_CERTIFICATE_CONFIG, and
420+
verifying it contains a "workload" section. If so, the function will return
421+
"true", otherwise "false".
421422
422423
Returns:
423-
str: A string("true" or "false" or value of the
424-
GOOGLE_API_USE_CLIENT_CERTIFICATE variable set) indicating if client
425-
certificate should be used.
424+
str: The value of GOOGLE_API_USE_CLIENT_CERTIFICATE, or an inferred value
425+
("true" or "false") if unset. This string should contain a value, but may
426+
be an any arbitrary string read from the user's set
427+
GOOGLE_API_USE_CLIENT_CERTIFICATE.
426428
"""
427429
use_client_cert = getenv("GOOGLE_API_USE_CLIENT_CERTIFICATE")
428430
# Check if the value of GOOGLE_API_USE_CLIENT_CERTIFICATE is set.
@@ -446,5 +448,4 @@ def check_use_client_cert():
446448
json.JSONDecodeError,
447449
) as e:
448450
_LOGGER.debug("error decoding certificate: %s", e)
449-
return "false"
450451
return "false"

google/auth/transport/grpc.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,7 @@
1717
from __future__ import absolute_import
1818

1919
import logging
20-
import os
2120

22-
from google.auth import environment_vars
2321
from google.auth import exceptions
2422
from google.auth.transport import _mtls_helper
2523
from google.oauth2 import service_account

google/auth/transport/requests.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
import functools
2020
import logging
2121
import numbers
22-
import os
2322
import time
2423

2524
try:
@@ -35,7 +34,6 @@
3534
) # pylint: disable=ungrouped-imports
3635

3736
from google.auth import _helpers
38-
from google.auth import environment_vars
3937
from google.auth import exceptions
4038
from google.auth import transport
4139
import google.auth.transport._mtls_helper

google/auth/transport/urllib3.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
from __future__ import absolute_import
1818

1919
import logging
20-
import os
2120
import warnings
2221

2322
# Certifi is Mozilla's certificate bundle. Urllib3 needs a certificate bundle
@@ -51,7 +50,6 @@
5150

5251

5352
from google.auth import _helpers
54-
from google.auth import environment_vars
5553
from google.auth import exceptions
5654
from google.auth import transport
5755
from google.oauth2 import service_account

0 commit comments

Comments
 (0)