亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

是否有可用于 google calendar api 的管理員帳戶?

是否有可用于 google calendar api 的管理員帳戶?

鳳凰求蠱 2021-10-05 17:04:59
我使用這個谷歌日歷 api 代碼來開發(你可以在這里找到代碼):from __future__ import print_functionimport datetimefrom googleapiclient.discovery import buildfrom httplib2 import Httpfrom 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文件?
查看完整描述

3 回答

?
倚天杖

TA貢獻1828條經驗 獲得超3個贊

是的,這稱為G Suite 域范圍委派。直接從鏈接的指南:

在企業應用程序中,您可能希望以編程方式訪問用戶的數據,而無需他們進行任何手動授權。在 G Suite 域中,域管理員可以授予第三方應用對其用戶數據的全域訪問權限——這稱為全域授權。為了以這種方式委派權限,域管理員可以使用 OAuth 2.0 的服務帳戶。


查看完整回答
反對 回復 2021-10-05
?
PIPIONE

TA貢獻1829條經驗 獲得超9個贊

這是管理員信息頁面

使用管理員帳戶登錄。

下載管理員的憑據.json。

像這樣使用管理員帳戶添加gmail地址,輸入fmail地址:

http://img1.sycdn.imooc.com//615c155f000159ea12810636.jpg

然后單擊Settings and sharing,然后您將找到 calendarId。

http://img1.sycdn.imooc.com//615c156d0001507f03860400.jpg

如果你公司有20人,重復這個操作20次,然后把20人的calendarId放到list里循環。


查看完整回答
反對 回復 2021-10-05
  • 3 回答
  • 0 關注
  • 299 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號