GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Adding optional switch to capture project ID in from_service_account_json(). by dhermes · Pull Request #3436 · googleapis/google-cloud-python

Conversation

@dhermes

@dhermes dhermes commented May 17, 2017

Copy link
Copy Markdown
Contributor

Fixes #1883.

@lukesneeringer This is a long-standing bug but should really make it into a google-cloud-core release. I know you hate releasing core.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@dhermes
Adding optional switch to capture project ID in from_service_account_…
d67cf45
…json().

Fixes googleapis#1883.
@dhermes dhermes added the api: core label May 17, 2017
@dhermes dhermes assigned lukesneeringer and tseaver May 17, 2017
@googlebot googlebot added the cla: yes This human has signed the Contributor License Agreement. label May 17, 2017
@theacodes

theacodes commented May 17, 2017 •
edited by dhermes
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

It would be great to solve this by just consolidating ClientWithProject and ClientWithCredentials Client

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@dhermes

dhermes commented May 17, 2017

Copy link
Copy Markdown
Contributor Author

@jonparrott See the table I made about usage. The only issue with that is some APIs don't use a project (and we don't want to fail their constructors over a missing project).

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@theacodes

theacodes commented May 17, 2017 via email •
edited by dhermes
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor
Does it help that google auth doesn't error if it can't determine a project?
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@dhermes

dhermes commented May 17, 2017

Copy link
Copy Markdown
Contributor Author

@jonparrott Mostly it doesn't help because it isn't true? :trollface:

Or do you mean something else?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@theacodes

theacodes commented May 17, 2017 via email •
edited by dhermes
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor
That's if it doesn't find credentials, not if it doesn't find the project.
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@dhermes

dhermes commented May 17, 2017

Copy link
Copy Markdown
Contributor Author

But there is no google.auth.default_project?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@theacodes

theacodes commented May 17, 2017 via email •
edited by dhermes
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor
Right. This is part of the constraint. You should never get a project ID that didn't come from the same source as the credentials.
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@dhermes

dhermes commented May 17, 2017

Copy link
Copy Markdown
Contributor Author

Makes sense.

@lukesneeringer WDYT of us just using project on every Client instance? (This would just bring Client and ClientWithProject together, ClientWithProject is already a tiny impl.)

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@tseaver

tseaver commented May 18, 2017 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

FTR, ClientWithProject is skipped by the following:

$ for f in $(ls */google/cloud/*/client.py); do
       if ! grep -q ClientWithProject $f; then
           echo $f
       fi
  done
bigtable/google/cloud/bigtable/client.py
language/google/cloud/language/client.py
resource_manager/google/cloud/resource_manager/client.py
spanner/google/cloud/spanner/client.py
speech/google/cloud/speech/client.py
translate/google/cloud/translate/client.py

Of those, the following have _ClientProjectMixin included:

$ for f in $(ls */google/cloud/*/client.py); do
       if ! grep -q ClientWithProject $f; then
           echo $f
       fi
  done | xargs grep -l _ClientProjectMixin
bigtable/google/cloud/bigtable/client.py
spanner/google/cloud/spanner/client.py
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@dhermes

dhermes commented May 19, 2017

Copy link
Copy Markdown
Contributor Author

@tseaver This is (intended to be) captured in my table

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

tseaver
tseaver reviewed May 19, 2017
View reviewed changes
Comment thread core/tests/unit/test_client.py
# Check that mocks were called as expected.
file_open.assert_called_once_with(
mock.sentinel.filename, 'r', encoding='utf-8')
constructor.assert_called_once_with(info)

This comment was marked as spam.

Sign in to view

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

This comment was marked as spam.

Sign in to view

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

tseaver
tseaver approved these changes May 19, 2017
View reviewed changes
@dhermes
dhermes merged commit a55010f into googleapis:master Jun 6, 2017
@dhermes
dhermes deleted the fix-1883 branch June 6, 2017 17:12
@dhermes

dhermes commented Jun 6, 2017

Copy link
Copy Markdown
Contributor Author

@tseaver Sorry I missed your LGTM 18 days ago.

It's good I got this in, in case we have a google-cloud-core release for your gRPC remap PR, this can go in too.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@tseaver tseaver mentioned this pull request Jun 7, 2017
Move '_catch_remap_gax_error' to 'core.exceptions'. #3444
Closed
This was referenced Jun 26, 2017
Prep core-0.25.0 release. #3526
Merged
Prep bigtable-0.25.0 release. #3534
Merged
Prep spanner-0.25.0 release. #3536
Merged
landrito pushed a commit to landrito/google-cloud-python that referenced this pull request Aug 21, 2017
@dhermes @landrito
Adding optional switch to capture project ID in from_service_account_…
d833cd0
…json(). (googleapis#3436)

Fixes googleapis#1883.
landrito pushed a commit to landrito/google-cloud-python that referenced this pull request Aug 22, 2017
@dhermes @landrito
Adding optional switch to capture project ID in from_service_account_…
9b7249c
…json(). (googleapis#3436)

Fixes googleapis#1883.
landrito pushed a commit to landrito/google-cloud-python that referenced this pull request Aug 22, 2017
@dhermes @landrito
Adding optional switch to capture project ID in from_service_account_…
4f938d6
…json(). (googleapis#3436)

Fixes googleapis#1883.
parthea pushed a commit that referenced this pull request Oct 21, 2023
Takashi Matsuo @busunkim96
[container_registry] fix: fix broken test [(#3436)](GoogleCloudPlatfo…
a812dec
…rm/python-docs-samples#3436)

* [container_registry] fix: fix broken test

fixes #3435

* Use Pub/Sub message receiver that can notify main thread
  when it has received expected number of messages.
* Only test one single occurence.
* Use uuid4 wherever makes sense.
* test if Pub/Sub client receives at least one message
parthea pushed a commit that referenced this pull request Nov 22, 2025
@dhermes
Adding optional switch to capture project ID in from_service_account_…
75f2d0c
…json(). (#3436)

Fixes #1883.
parthea pushed a commit that referenced this pull request Nov 24, 2025
@dhermes
Adding optional switch to capture project ID in from_service_account_…
c7be5a7
…json(). (#3436)

Fixes #1883.
parthea pushed a commit that referenced this pull request Mar 9, 2026
@dhermes
Adding optional switch to capture project ID in from_service_account_…
12b4807
…json(). (#3436)

Fixes #1883.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

1 more reviewer
@tseaver tseaver tseaver approved these changes
Reviewers whose approvals may not affect merge requirements

Uh oh!

There was an error while loading. Please reload this page.

Assignees

@lukesneeringer lukesneeringer

@tseaver tseaver

Labels

api: core cla: yes This human has signed the Contributor License Agreement.

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

5 participants

@dhermes @theacodes @tseaver @lukesneeringer @googlebot
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.