在 GAE 上的 Python 中解析来自 InsertCalendar 的原子响应(日历 API)
在 Python 中通过 App Engine 使用 GData Calendar API,当您创建事件时,有一些方便的小帮助方法来解析响应:
new_event = calendar_service.InsertEvent(event, '/calendar/feeds/default/private/full')
helper = new_event.GetEditLink().href
当您创建新日历时:
new_calendar = gd_client.InsertCalendar(new_calendar=calendar)
我想知道是否可能有我找不到的相关方法在文档中(或者可能没有文档记录)?
我需要将新日历的 ID 存储在数据存储中,因此我想要以下内容:
new_calendar = gd_client.InsertCalendar(new_calendar=calendar)
new_calendar.getGroupLink().href
在我的代码中,正在创建日历,并且 G 使用 201 返回 Atom 响应,但在我开始使用 elementtree 之前或atom.parse来提取所需的元素,我希望这里有人能够提供帮助。
非常感谢提前:)
Using the GData Calendar API via App Engine in Python, when you create an event there are handy little helper methods to parse the response:
new_event = calendar_service.InsertEvent(event, '/calendar/feeds/default/private/full')
helper = new_event.GetEditLink().href
When you create a new calendar:
new_calendar = gd_client.InsertCalendar(new_calendar=calendar)
I was wondering if there might be related methods that I just can't find in the documentation (or that are--perhaps--undocumented)?
I need to store the new calendar's ID in the datastore, so I would like something along the lines of:
new_calendar = gd_client.InsertCalendar(new_calendar=calendar)
new_calendar.getGroupLink().href
In my code, the calendar is being created, and G is returning the Atom response with a 201, but before I get into using elementtree or atom.parse to extract the desired element, I was hoping someone here might be able to help.
Many thanks in advance :)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我从未使用过 GData API,所以我可能是错的,但是...
看起来
GetLink()
将返回任何指定关系的链接对象。看起来像GetEditLink()
只是调用GetLink()
,传入编辑链接的 rel 。因此,您应该能够对InsertCalendar()
的响应调用GetLink()
,并传入 Group 链接的 rel。这是我用来解决这个问题的 pydoc 信息: http://gdata-python-client.googlecode.com/svn/trunk/pydocs/gdata.calendar_resource.data.html
I've never used the GData API, so I could be wrong, but...
It looks like
GetLink()
will return the link object for any specified rel. Seems likeGetEditLink()
just callsGetLink()
, passing in the rel of the Edit link. So you should be able to callGetLink()
on the response fromInsertCalendar()
, and pass in the rel of the Group link.Here's the pydoc info that I used to figure this out: http://gdata-python-client.googlecode.com/svn/trunk/pydocs/gdata.calendar_resource.data.html