I am trying to change the example of the Google Glass Mirror quick-start mirror API to respond to the user response "RESPONSE".
I can display a valid map using the example with the REPLY built-in action.
I want the user to be able to respond with a reading of the scientific tool that I want to be able to display and return the map back to the user.
However, I am stuck at step zero. How to get the value that the user "answered".
Here is my attempt to sign up for a schedule. I can get the “SUBSCRIBE” message in my application log.
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
The map I generate is based on an example.
def _insert_item_with_action(self): """Insert a timeline item user can reply to.""" logging.info('Inserting timeline item') body = { 'creator': { 'displayName': 'Python Starter Project', 'id': 'PYTHON_STARTER_PROJECT' }, 'text': 'A600 at current time:', 'id':'a600val', 'notification': {'level': 'DEFAULT'}, 'menuItems': [{'action': 'REPLY', }], }
I also created a "dummy" handler for the endopoint callbackUrl "logA600" as follows.
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")
MAIN_ROUTES = [('/', MainHandler), ('/ logA600', A600Handler),]
When I answer the timeline map. My logs never display the POST received by my handler with the expected message "Received POST to logA600". Instead, I get the following in my application logs.
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
In my test application. I see that the timeline map is arriving successfully. I am looking for help in getting a “RESPONSE” notification subscription to my callbackUrl / logA600 handler.