Skip to content

Instantly share code, notes, and snippets.

@elibixby
Created June 20, 2016 20:45
Show Gist options
  • Save elibixby/40c07cd47df15f7b0f1db0f575518058 to your computer and use it in GitHub Desktop.
Save elibixby/40c07cd47df15f7b0f1db0f575518058 to your computer and use it in GitHub Desktop.
from googleapiclient.discovery import build
from oauth2client.client import GoogleCredentials
from oauth2client.contrib.gce import AppAssertionCredentials
def main():
creds = GoogleCredentials.get_application_default()
client = build('compute', 'v1', credentials=creds)
print(client.instances().list(project='project-id', zone='zone').execute())
creds = AppAssertionCredentials()
client = build('compute', 'v1', credentials=creds)
print(client.instances().list(project='project-id', zone='zone').execute())
if __name__ == '__main__':
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment