feat: Use float instead of int for GCE_METADATA_TIMEOUT by ludoch · Pull Request #1481 · googleapis/google-auth-library-python
Move the logic to read GCE_METADATA_TIMEOUT env variable so we can better control it in app_identity component. Related internal change is 607513254.
requested a review
from a team
ludoch
changed the title
Move the logic to read GCE_METADATA_TIMEOUT.
Update _metadata.py
clundin25
changed the title
Update _metadata.py
feat: Use float instead of int for GCE_METADATA_TIMEOUT
judahrand added a commit to judahrand/google-auth-library-python that referenced this pull request
Mar 2, 2024* chore(python): update dependencies in /.kokoro (googleapis#1499) Source-Link: googleapis/synthtool@db94845 Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:a8a80fc6456e433df53fc2a0d72ca0345db0ddefb409f1b75b118dfd1babd952 Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com> Co-authored-by: Anthonios Partheniou <partheniou@google.com> * Add a test with new _metadata.py changes * Add tests for metadata changes. * chore(python): bump idna from 3.4 to 3.7 in .kokoro (googleapis#1517) Source-Link: googleapis/synthtool@d50980e Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:5a4c19d17e597b92d786e569be101e636c9c2817731f80a5adec56b2aa8fe070 Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com> Co-authored-by: Anthonios Partheniou <partheniou@google.com> * Update environment_vars.py --------- Co-authored-by: gcf-owl-bot[bot] <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com> Co-authored-by: Anthonios Partheniou <partheniou@google.com>
chalmerlowe added a commit that referenced this pull request
Jan 9, 2026Currently, `google.auth.default()` always attempts to authenticate using the Google Compute Engine (GCE) metadata service as a fallback. There is no easy way to prevent this behavior, leading to unnecessary delays and unhelpful exceptions, particularly in cases where GCE-based authentication is pointless or undesired. This pull request introduces a `NO_GCE_CHECK` environment variable, allowing users to explicitly skip GCE metadata service authentication. This implementation mirrors `NO_GCE_CHECK` in [googleapis/google-auth-library-java](https://github.com/googleapis/google-auth-library-java/blob/f154edb3d8503d29f0020b6904dfa40e034ded93/README.md?plain=1#L106-L119): > _The following are searched (in order) to find the Application Default Credentials:_ > > [...] > > 5. Google Compute Engine built-in credentials > - Skip this check by setting the environment variable `NO_GCE_CHECK=true` > [!NOTE] > Other clouds also provide similar environment variables, such as `AWS_EC2_METADATA_DISABLED` on AWS. This change is also tangentially related to the following pull requests: - #1488 - #1481 --------- Co-authored-by: Anthonios Partheniou <partheniou@google.com> Co-authored-by: Chalmer Lowe <chalmerlowe@google.com>
parthea added a commit to googleapis/google-cloud-python that referenced this pull request
Mar 2, 2026Currently, `google.auth.default()` always attempts to authenticate using the Google Compute Engine (GCE) metadata service as a fallback. There is no easy way to prevent this behavior, leading to unnecessary delays and unhelpful exceptions, particularly in cases where GCE-based authentication is pointless or undesired. This pull request introduces a `NO_GCE_CHECK` environment variable, allowing users to explicitly skip GCE metadata service authentication. This implementation mirrors `NO_GCE_CHECK` in [googleapis/google-auth-library-java](https://github.com/googleapis/google-auth-library-java/blob/f154edb3d8503d29f0020b6904dfa40e034ded93/README.md?plain=1#L106-L119): > _The following are searched (in order) to find the Application Default Credentials:_ > > [...] > > 5. Google Compute Engine built-in credentials > - Skip this check by setting the environment variable `NO_GCE_CHECK=true` > [!NOTE] > Other clouds also provide similar environment variables, such as `AWS_EC2_METADATA_DISABLED` on AWS. This change is also tangentially related to the following pull requests: - googleapis/google-auth-library-python#1488 - googleapis/google-auth-library-python#1481 --------- Co-authored-by: Anthonios Partheniou <partheniou@google.com> Co-authored-by: Chalmer Lowe <chalmerlowe@google.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters