- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我使用 Python 构建了一个应用程序并将其连接到谷歌日历 API。
我不明白为什么会收到此错误“Google Calendar API:403 使用服务帐户超出日历使用限制”
我几乎没有添加事件,一周大概 300 个。
我以前有一个旧帐户,几天之内就增加了数千个。现在,有了这个新的免费帐户,它给了我这个错误!
我能做什么?它可以修复吗?!
启动日历服务:
def initiate_calendar_service():
"""Shows basic usage of the Google Calendar API.
Prints the start and name of the next 10 events on the user's calendar.
"""
creds = None
# The file token.pickle stores the user's access and refresh tokens, and is
# created automatically when the authorization flow completes for the first
# time.
if os.path.exists('token.pickle'):
with open('token.pickle', 'rb') as token:
creds = pickle.load(token)
# If there are no (valid) credentials available, let the user log in.
if not creds or not creds.valid:
if creds and creds.expired and creds.refresh_token:
creds.refresh(Request())
else:
flow = InstalledAppFlow.from_client_secrets_file(
'credentials.json', SCOPES)
creds = flow.run_local_server(port=0)
# Save the credentials for the next run
with open('token.pickle', 'wb') as token:
pickle.dump(creds, token)
service = build('calendar', 'v3', credentials=creds)
return service
添加事件:
for i in range(1):
startStrip = datetime.datetime.strptime(event_start, "%Y-%m-%dT%H:%M:%S")
endStrip = datetime.datetime.strptime(event_end, "%Y-%m-%dT%H:%M:%S")
dayOfWeek = startStrip + datetime.timedelta(days=i)
# les bons formats
currentStart = str(startStrip + datetime.timedelta(days=i)).replace(" ", "T")
currentEnd = str(endStrip + datetime.timedelta(days=i)).replace(" ", "T")
calendarEnd = str(endStrip + datetime.timedelta(days=i + 1)).replace(" ", "T")
events_result = service.events().list(calendarId='primary', timeMin=currentStart + "-00:00",
maxResults=30, timeMax=calendarEnd + "-00:00",
singleEvents=True, orderBy='startTime').execute()
events = events_result.get('items', [])
currentEmployees = []
for event in events:
currentEmployees.append(event['summary'])
if employee in currentEmployees:
event_done = False
event['summary'] = employee
for event in events:
if str2datetime(currentStart) <= str2datetime(event['end']['dateTime'].split('+')[0]) and str2datetime(currentEnd) >= str2datetime(event['start']['dateTime'].split('+')[0]):
event_done = False
print(employee + ' est occupé')
break
else:
event_done = True
break
if employee not in currentEmployees:
event_done = True
if event_done:
option = show_message_box(QMessageBox.Critical,
"Confirmation",
"Voulez-vous bloquer cette plage horraire?"\
"L'employé : \"" + employee + "\" sera marqué comme indisponible en raison de : " + reason, \
"Nom de l'employé: " + employee + "\n" \
"Raison: " + reason + "\n" \
"À partir du : " + currentStart + "\n" \
"À ce jour " + currentEnd + "\n"
)
if option == QMessageBox.Yes:
event_done = True
else:
print("Événement ignoré!")
event_done = False
break
if event_done:
event = {
'summary': employee,
'location': location,
'description': reason,
'start': {
'dateTime': currentStart,
'timeZone': 'America/New_York',
},
'end': {
'dateTime': currentEnd,
'timeZone': 'America/New_York',
},
'attendees': [
{'email': event_email},
],
'reminders': {
'useDefault': True,
},
}
register_event(service, event)
else:
second_message_box(QMessageBox.Critical,
"ATTENTION!",
"L'inspecteur " + employee + " est déjà occupé à ce moment-là.""\n" \
"Veuillez essayer une autre plage horraire.", QMessageBox.Ok)
附加信息:
我有一个帐户,在 1 个月内,我发出了 3041 次 calendar.events.list 请求。和 181 calendar.events.insert。
我没有问题。
这一次,使用新帐户,我在 2 天内执行了 730 个 calendar.events.list 请求和 175 个 calendar.events.insert。 2天175个事件插入是不是很多??
最佳答案
当我被授权使用 Google Calendar API 时,我遇到了同样的错误,例如 myuser@gmail.com,然后我试图将相同的用户 (myuser@gmail.com) 添加为与会者。
当我添加除 myuser@gmail.com 之外的任何其他与会者时,它起作用了。
这可以解释为什么有时会出现错误,有时却不会。
关于python - 谷歌日历 API : 403 Calendar Usage Limits Exceeded,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62508640/
我有以下 Java 代码: public static void fun(int[] a) { int min; for(int j=0;j
我每天都在使用 PHPStorm 中出色的查找用法功能,搜索结果属于以下两个类别之一: 非代码用法 发现用法 我几乎对非代码用法不感兴趣。此外,当我寻找名为 get() 或 set() 的方法的用法时
我正在尝试在 Visual Studio 中分析我的 UWP(通用 Windows 平台)应用程序,以查看导致我的进程内存使用率如此之高的原因。 我一直在使用 Visual Studio 的内置诊断工
这个问题可能也适用于其他库,但是使用 Cassandra 作为一个具体的例子来确保我问的是一个可以回答的问题: 使用 Kotlin,我可以使用 Cassandra 的异步方法,然后用 Listenab
我正在开发一个简单的命令行工具,但我发现默认的 Usage 消息有点欠缺。我想定义我自己的,我认为我做对了我指的是 this example . 我注释掉了我编写的大部分代码,因此包含 main 函数
我正在从应用程序 A 向 Artemis 发送消息,但我从应用程序 A 收到此错误: AMQ212054: Destination address=my-service is blocked. If
我正在从应用程序 A 向 Artemis 发送消息,但我从应用程序 A 收到此错误: AMQ212054: Destination address=my-service is blocked. If
我阅读了有关在 PostgreSQL 中授予序列的答案。通常,他们说同时授予 SELECT、USAGE。我想知道我是否可以只授予 USAGE。哪一个是授予序列的最佳实践,为什么? 最佳答案 Quote
我正在尝试查看我的使用计划中每个 API key 的使用情况。但是当我跑 aws apigateway get-usage --usage-plan-id ***** --start-date 202
我正在使用 Spring Boot 2.3.2。在执行器的帮助下,将应用程序指标发布到指标控制台。我想知道 system.cpu.usage 和有什么区别和 process.cpu.usage执行器优
将 Xamarin.Forms iOS 应用提交到 Apple 的 TestFlight 后,我们收到以下消息。 消息: Dear Developer, We identified one or
我想捕获以下参数: lastAccessedTime - 用户上次访问站点的时间(通常在登录过程中显示) isOnline - 表示用户是否在线的 bool 值。 一种。将这些变量作为用户表本身的一部
我的Web服务器上偶尔有HTTPD请求,这会增加CPU使用率。我在顶部观看此视频。每个URL都是在每次请求时动态生成的。该框架是Codeigniter。我正在使用prefork Apache作为Lin
我们有一个非常小的专业用户群。 没有社区。 我的老板想找出谁在使用它。他的方法是简单地建立一个隐藏的连接,也许是一个自动更新功能,默认情况下在没有更新的情况下启用WITHOUT通知... 我不太喜欢这
我正在尝试监视安装和运行Prometheus的计算机的cpu利用率。我有一个指标'process_cpu_seconds_total'。我可以找到该指标的评分或评分。但是我不太确定如何得出CPU利用率
是否可以估计单个进程在运行时产生的热量。 处理器的温度读数很容易获得,但我需要的是进程特定的信息。 是否可以映射 CPU 利用率、IO、运行时间、内存使用等信息来获得某种估计? 最佳答案 我要说不。因
当一个内核的 CPU 使用率为 100% 时,这意味着什么? 这是否意味着进程已经达到了内核的最大可能性能(使用矢量化),还是意味着 CPU 正在执行与内核时钟一样多的周期? 另外,如果它是 100%
这个问题已经有答案了: some macro statements may have unexpected results in C++? (3 个回答) 已关闭 9 年前。 以下脚本的输出是 20。
我似乎无法使用 JSON::XS的OO接口(interface)正常。以下呱呱叫我无法追踪的错误: use JSON::XS; my $array = ['foo', 'bar']; my $code
我希望我们的应用程序在第一次启动时向服务器发送一些匿名信息(操作系统、Java 版本等)。唯一的用途是确定正在使用的副本数量,并了解我们的客户最常使用哪些操作系统,以便我们知道将测试重点放在何处。 我
我是一名优秀的程序员,十分优秀!