因此,我正在尝试使用一些代码,这些文件需要一个ical文件并将其同步到我的Google日历。我用作基础的代码可以在here中找到。
但是,我似乎在代码中出现错误,使我相信我在认证凭据方面遇到麻烦。
以下是我用于身份验证的代码:
user
我得到的错误是:
def get_credentials():
store = Storage(CREDENTIAL_PATH)
credentials = store.get()
if not credentials or credentials.invalid:
flow = client.flow_from_clientsecrets(CLIENT_SECRET_FILE, SCOPES)
flow.user_agent = APPLICATION_NAME
credentials = tools.run_flow(flow, store, None)
return credentials
credentials = get_credentials()
http = credentials.authorize(httplib2.Http())
service = discovery.build('calendar', 'v3', http=http)
service.events().update(calendarId=CALENDAR_ID, eventId=gcal_event['id'],body=gcal_event).execute()
我的凭据没有通过身份验证吗?我在Google Sheets api上使用了非常相似的代码结构,效果很好。
我还应该注意,在脚本的前面部分中,我日历中的事件实际上是从Google日历API中获取的。
更新:
看起来与身份验证无关。而是日历事件ID的格式不正确。有谁知道将文本字符串转换为base32hex编码格式的方法吗?
答案 0 :(得分:0)
您需要注册付费访问或限制您在一天内提出的请求数量。从Calendar API的Google API文档中获得
Google Calendar API的每日礼遇上限为1,000,000个查询。
借自:https://developers.google.com/calendar/pricing
有关特定错误和其他可能解决方案的详细信息,请参阅Google文档的其余部分https://developers.google.com/calendar/v3/errors#403_daily_limit_exceeded