我有一个场景,客户端(移动应用程序)会向我的GAE网站发送更新查询以查看该网站是否有更新版本的资源,如果有,它将返回此资源(zip文件),否则它只会返回“所有最新”的json响应(或者可能是未修改的304 HTTP响应代码)
REST URL应该如何显示(来自移动应用程序)?
www.example.com/update?version=(client_version)
要么
www.example.com/update_client_version
感谢我能得到的任何帮助。
到目前为止我所拥有的是......但是当我做http://localhost:8080/update/1时我出于某种原因得到404
INFO 2012-11-22 10:12:18,441 dev_appserver.py:3092] "GET /holidays/1 HTTP/1.1" 404 -
class UpdateHandler(webapp2.RequestHandler): def get(self, version): latestVersion == 1 if version == latestVersion: self.response.write('You are using latest version') else: self.response.write('You are not using latest version') app = webapp2.WSGIApplication([('/update/(.*)', UpdateHandler)], debug=True)I have a scenario where a client (mobile app) would send an update query to my GAE website to see if the website has a newer version of a resource and if it does it would return this resource (zip-file) otherwise it would just return a json response "all up to date" (or perhaps a Not Modified 304 HTTP response code)
How should the REST URL look (coming from the mobile app)?
www.example.com/update?version=(client_version)
OR
www.example.com/update_client_version
Thankful for any help I can get.
What I have so far is... but I'm getting a 404 for some reason when doing http://localhost:8080/update/1
INFO 2012-11-22 10:12:18,441 dev_appserver.py:3092] "GET /holidays/1 HTTP/1.1" 404 -
class UpdateHandler(webapp2.RequestHandler): def get(self, version): latestVersion == 1 if version == latestVersion: self.response.write('You are using latest version') else: self.response.write('You are not using latest version') app = webapp2.WSGIApplication([('/update/(.*)', UpdateHandler)], debug=True)最满意答案
我会采用以下方法:
www.example.com/update/client_version
您的代码应如下所示:
import webapp2 class UpdateHandler(webapp2.RequestHandler): def get(self, version): # Do something for version app = webapp2.WSGIApplication( [(r'/update/(\d+)', UpdateHandler)], debug=True)I would go with the following approach:
www.example.com/update/client_version
Your code should look like this:
import webapp2 class UpdateHandler(webapp2.RequestHandler): def get(self, version): # Do something for version app = webapp2.WSGIApplication( [(r'/update/(\d+)', UpdateHandler)], debug=True)更多推荐
发布评论