从googleglass的callbackURL endpoin获取“回复”通知

2024-05-29 01:58:58 发布

您现在位置:Python中文网/ 问答频道 /正文

我试图修改“镜像快速启动”googleglass镜像API示例,以响应用户的“回复”操作。在

我能够显示一个可操作的卡使用的例子与回复内置的行动。在

我希望用户能够用一个科学仪器的读数来回复,我希望能够绘制出一张卡片并返回给用户。在

但是我被困在第零步。如何获取用户“回复”的值。在

这是我试图订阅时间轴的尝试。我可以在appengine日志中看到“SUBSCRIBED”消息。在

def _insert_a600_subscription(self):
"""Attempt to register to a600 updates"""
subscription = {
    "collection" : 'timeline',
    "userToken" : self.userid,
    "callbackUrl":"https://myapp_on_appengine.appspot.com/logA600",
     }
try:
    self.mirror_service.subscriptions().insert(body=subscription).execute()
    logging.info("SUBSCRIBED")
except errors.HttpError, error:
    print 'An error occurred: %s' % e

我生成的卡片就是基于这个例子。在

^{pr2}$

我还为callbackUrl内点“logA600”创建了一个“dummy”处理程序,如下所示。在

class A600Handler(webapp2.RequestHandler):

@util.auth_required
def post(self):
    """Process the value of A600 received and return a plot"""
    logging.info("Received POST to logA600")

@util.auth_required
def get(self):
    """Process the value of A600 received and return a plot"""
    logging.info("Received GET to this logA600")

主要路线=[ (“/”,主处理程序)、(“/logA600”,A600Handler), ]在

当我回复时间表卡的时候。我的日志从来没有显示收到给我的处理程序的POST,并显示预期的消息“received POST to logA600”。在

2013-07-15 19:52:43.913 /logA600 302 37ms 0kb GlassAPI XX.XXX.XX.XX - - [15/Jul/2013:16:52:43 -0700] "POST /logA600 HTTP/1.1" 302 136 - "GlassAPI" "myapp_on_appengine.appspot.com" ms=37 cpu_ms=0 cpm_usd=0.000032 app_engine_release=1.8.2 instance=0XXXXXXXXXXXXXXXXXXXXXXXXd I 2013-07-15 19:52:43.889 URL being requested: https://www.googleapis.com/discovery/v1/apis/mirror/v1/rest?userIp=xx.xx.xx.xxx

在我的测试应用程序上。我可以看到时间表卡成功到达。我正在寻找帮助,以获取“回复”通知“订阅”到我的callbackUrl/logA600处理程序。在


Tags: to用户selfinfocom处理程序loggingdef
1条回答
网友
1楼 · 发布于 2024-05-29 01:58:58

删除/logA600def post(self):之前的@util.auth_required。在

发生这种情况的原因是,@util.auth_required检查以验证当前用户是否已被授权,如果没有,则会将其重定向到OAuth 2.0流启动URL。订阅通知不是授权请求。它们没有任何cookies,就好像是匿名用户一样。看到这一点,@util.auth_required正在将通知重定向到身份验证页。在

相关问题 更多 >

    热门问题