Mr. Nun.
Mr. Nun.

Reputation: 850

GCE - basic API usage - Instances

I Want to use "Instances" in the Python API...for some reaseon, my code returns an Empty Error:

Error: []

my code:

email = "[email protected]"
with open("somefile.p12") as f:
   pkey = f.read()
cred = SignedJwtAssertionCredentials(email,key, "https://www.googleapis.com/auth/devstorage.read_write")
compute = build('compute','v1',credentials=cred)

then with the simplest API call:

compute.instances().list(project="firebase-client", zone="us-central1-f").execute()

the error pops...

Upvotes: 0

Views: 400

Answers (1)

Misha Brukman
Misha Brukman

Reputation: 13424

As mentioned and confirmed in the comment, the solution here is to use the right scope: https://www.googleapis.com/auth/compute is what you want for read-write access to Google Compute Engine APIs.

The scope URL in the question code sample: https://www.googleapis.com/auth/devstorage.read_write provides read-write access to Google Cloud Storage API instead.

Upvotes: 1

Related Questions