我的代码如下:
from pprint import pprint
from googleapiclient import discovery
from oauth2client.client import GoogleCredentials
credentials = GoogleCredentials.get_application_default()
service = discovery.build('cloudresourcemanager', 'v1', credentials=credentials)
while True:
request = service.projects().list()
response = request.execute()
for project in response.get('projects', []):
# TODO: Change code below to process each `project` resource:
pprint(project)
我得到了错误:
Traceback (most recent call last):
File "sample.py", line 18, in <module>
request = service.projects.list()
AttributeError: 'function' object has no attribute 'list'
此代码在google api资源管理器网站上列出。