因此,我尝试使用python抓取用户的研究项目的活动流,目前正在调查API调用问题。
根据API文档,我的范围设置为https://www.googleapis.com/auth/plus.stream.read
和https://www.googleapis.com/auth/plus.me然而,每当我尝试拨打电话时,我都会收到一个错误报告范围问题
有没有人遇到过这个问题和/或有关于如何绕过它的热门提示?
from oauth2client.client import flow_from_clientsecrets
import webbrowser
import httplib2
from apiclient.discovery import build
service = build('plus', 'v1')
if __name__ == '__main__':
print 'Running oauth script'
flow = flow_from_clientsecrets('client_secret.json',
scope='https://www.googleapis.com/auth/plus.login https://www.googleapis.com/auth/plus.stream.read',
redirect_uri='urn:ietf:wg:oauth:2.0:oob')
auth_uri = flow.step1_get_authorize_url()
webbrowser.get().open_new(auth_uri)
auth_code = raw_input('Enter the auth code: ')
credentials = flow.step2_exchange(auth_code)
http_auth = credentials.authorize(httplib2.Http())
http = httplib2.Http()
http = credentials.authorize(http)
activities_resource = service.activities()
request = activities_resource.list(userId = id_list.readline().split('\n'), collection = 'user', maxResults = '20' )
(注意:显然我的代码还有更多,但这就是我认为的相关内容。我认为它也值得说明我知道这是python和缩进很重要,但请在缩进中假设任何明显的错误是我复制和粘贴的结果,因为我还没有掌握在这个网站上格式化代码的艺术。)