我使用这个谷歌日历 api 代码来开发(你可以在这里找到代码):
from __future__ import print_function
import datetime
from googleapiclient.discovery import build
from httplib2 import Http
from oauth2client import file, client, tools
# If modifying these scopes, delete the file token.json.
SCOPES = 'https://www.googleapis.com/auth/calendar.readonly'
def main():
"""Shows basic usage of the Google Calendar API.
Prints the start and name of the next 10 events on the user's calendar.
"""
# The file token.json stores the user's access and refresh tokens, and is
# created automatically when the authorization flow completes for the first
# time.
store = file.Storage('token.json')
creds = store.get()
if not creds or creds.invalid:
flow = client.flow_from_clientsecrets('./credentials.json', SCOPES)
creds = tools.run_flow(flow, store)
service = build('calendar', 'v3', http=creds.authorize(Http()))
# Call the Calendar API
now = datetime.datetime.utcnow().isoformat() + 'Z' # 'Z' indicates UTC time
print('Getting the upcoming 10 events')
events_result = service.events().list(calendarId='primary', timeMin=now,
maxResults=10, singleEvents=True,
orderBy='startTime').execute()
events_result = service.events().list(calendarId='primary',timeMin=now,).execute()
events = events_result.get('items', [])
if not events:
print('No upcoming events found.')
for event in events:
start = event['start'].get('dateTime', event['start'].get('date'))
print(start, event['summary'])
if __name__ == '__main__':
main()
我在使用日历API开发的时候,第一次点击页面的权限按钮,pycharm控制台就可以返回输出了。
有没有管理员账号可以控制100多人的账号?比如我们公司有100人,如果我要获取100人的数据,是否需要获取100人的账户信息(Gmail账户和密码)和credentials.json文件?
当我第一次运行每个人的credentials.json文件的代码时,我需要为100个人点击100次“承认”,这不好。我希望有管理员权限来简化这个操作。
有没有管理员账号可以控制这100个人?我需要下载 100 个人的凭据.json 文件吗?
下一步应该点击哪个,如何获取大家的json文件?
倚天杖
PIPIONE
相关分类