第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

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

更改訂閱日歷中事件的顏色時禁止響應(yīng) 403

更改訂閱日歷中事件的顏色時禁止響應(yīng) 403

有只小跳蛙 2023-10-26 14:39:43
我正在嘗試根據(jù) Google 日歷活動的位置更改其顏色。我想要更改的事件是帶有網(wǎng)絡(luò)呼叫鏈接的同步日歷的一部分。我無法單獨更改每個事件的顏色,但我可以設(shè)置日歷的顏色。以下代碼允許我更改另一個非同步日歷(我自己創(chuàng)建的)的各個事件的顏色,但對于同步日歷,我收到錯誤403: Forbidden。 HttpError: <HttpError 403 when requesting https://www.googleapis.com/calendar/v3/calendars/CALENDAR_ID/events/EVENT_ID?alt=json returned "Forbidden">from apiclient.discovery import buildfrom google_auth_oauthlib.flow import InstalledAppFlowscopes = ['https://www.googleapis.com/auth/calendar']flow = InstalledAppFlow.from_client_secrets_file("client_secret.json", scopes=scopes)credentials = flow.run_console()service = build("calendar", "v3", credentials=credentials)calId = "my_calendar_id"calendar = service.events().list(calendarId=calId).execute()keyword = "my_location_keyword"for event in calendar['items']: # I navigate through each event of the specified calendar    if 'location' in event and event['location'].find(keyword):     # if the location exists and contains the keyword, then i change the color        service.events().patch(calendarId=calId, eventId=event['id'], body={"colorId":10}).execute()有沒有辦法改變顏色而不觸發(fā)禁止的錯誤?在我看來,顏色不應(yīng)該受到授權(quán)保護......我考慮過將日歷復(fù)制到我有寫入權(quán)限的另一個日歷中,并更改新日歷上的顏色,但這似乎有點矯枉過正。還有更好的主意嗎?
查看完整描述

1 回答

?
千萬里不及你

TA貢獻1784條經(jīng)驗 獲得超9個贊

回答:

Code: 403 ?Message: Forbidden錯誤表明嘗試編輯日歷事件的帳戶沒有日歷的編輯權(quán)限。您必須在日歷共享設(shè)置中更改此設(shè)置。

更多信息:

與個人共享日歷有四個選項,如日歷 UI 中所示:


https://img1.sycdn.imooc.com/653a09cc0001e0be02460167.jpg

除非個人擁有Make changes to eventsMake changes and manage sharing訪問日歷,否則Forbidden將收到此響應(yīng)。

筆記:

根據(jù)處理日歷 API 錯誤的文檔:

403:非組織者禁止

事件更新請求正在嘗試在不屬于組織者的副本中設(shè)置共享事件屬性之一。共享屬性(例如guestsCanInviteOthersguestsCanModifyguestsCanSeeOtherGuests)只能由組織者設(shè)置。

雖然此錯誤的詳細(xì)信息似乎與您描述的簡單得多的錯誤不同403: Forbidden,但這可能是由于 API 更改所致。如果您嘗試更改此處指定的屬性之一(guestsCanModify例如 ),而沒有上述日歷共享設(shè)置,則會返回相同的、更簡單的 403 錯誤:

{

?"error": {

? "errors": [

? ?{

? ? "domain": "global",

? ? "reason": "forbidden",

? ? "message": "Forbidden"

? ?}

? ],

? "code": 403,

? "message": "Forbidden"

?}

}

因此,建議您檢查日歷的共享設(shè)置,因為如果colorId沒有正確設(shè)置,非組織者的用戶將無法編輯日歷。



查看完整回答
反對 回復(fù) 2023-10-26
  • 1 回答
  • 0 關(guān)注
  • 175 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動學(xué)習(xí)伙伴

公眾號

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號