通过扩展属性查询python gdata Calendar API
使用Python GData Calendar API,有没有办法搜索/查询具有特定扩展属性的事件?
即,我的程序正在创建日历事件并设置扩展属性 ProgramID='xxxxx'。在稍后的一段时间里,我想找到extend_property.ProgramID=='xxxx'的所有事件,
我目前通过执行一般查询然后循环遍历每个事件来查找正确的扩展属性来完成此操作。这是非常耗时和 CPU 密集型的,所以我想加快这个过程。
query = gdata.calendar.client.CalendarEventQuery()
feed = gcal.GetCalendarEventFeed(q=query)
for i, calEvent in enumerate(feed.entry):
calEventProperties = calEvent.extended_property
mikkiEvent = False
mikkiEventKey = ''
for eventProperty in calEventProperties:
if eventProperty.name == SETTINGS['CALID']:
mikkiEvent = True
if eventProperty.name == str(SETTINGS['CALID'] + 'EventKey'):
mikkiEventKey = eventProperty.value
我在 API 文档中找不到解释如何向查询添加扩展属性查询的地方。
Using the Python GData Calendar API, is there a way to search/query for events with specific extended properties?
Ie, my program is creating calendar events and setting an extended property ProgramID='xxxxx'. In a later period, I'd like to find all of the events where extended_property.ProgramID=='xxxx'
I'm currently accomplishing this by doing a general query and then looping through each looking for the correct extended properties. It's extremely time and CPU intensive, so I'd like to speed up the process.
query = gdata.calendar.client.CalendarEventQuery()
feed = gcal.GetCalendarEventFeed(q=query)
for i, calEvent in enumerate(feed.entry):
calEventProperties = calEvent.extended_property
mikkiEvent = False
mikkiEventKey = ''
for eventProperty in calEventProperties:
if eventProperty.name == SETTINGS['CALID']:
mikkiEvent = True
if eventProperty.name == str(SETTINGS['CALID'] + 'EventKey'):
mikkiEventKey = eventProperty.value
I can't find a place in the API Doc explaining how to add an extended property query to the query.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
目前无法通过扩展属性进行查询。
根据您对应用程序和日历的控制程度,您可以通过在描述字段上放置某种元数据、查询该元数据,然后通过扩展过滤结果(正如您当前所做的那样)来解决此问题。属性匹配。
At this moment you can not query by extended properties.
Depending on how much control you have over the application and the calendars you can work around this by placing some sort of meta-data on the description field, querying for that and then filtering the results (as you're currently doing) via the extended property match.