Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Added new API endpoint for Android to check its time against.

  • Loading branch information...
commit 4cd927f66e3b552a8997e622df97d0a359c80615 1 parent 0963621
@paddyforan paddyforan authored
Showing with 14 additions and 2 deletions.
  1. +14 −2 devlinks.py
View
16 devlinks.py
@@ -6,6 +6,7 @@
from google.appengine.ext.webapp import template
from google.appengine.ext.webapp.util import run_wsgi_app
from google.appengine.api import users, prospective_search, memcache
+from datetime import datetime
import time
import auth
@@ -231,7 +232,7 @@ def post(self):
if datapoint.duration == "day":
last_seen = last_seen.replace(hour=0, minute=0, second=0,
microsecond=0)
- new_last_seen = new_last_seen.replace(hour=0, minute=0,
+ new_last_seen = new_last_seen.replace(hour=0, minute=0,
second=0, microsecond=0)
if last_seen < new_last_seen:
user.updateLastSeen(new_last_seen)
@@ -295,7 +296,8 @@ def get(self):
point_id = "%s" % hour
if datapoint.duration == "day":
point_id = "total"
- stats[datestamp]['datapoints'][datapoint.datapoint]['values'][point_id] = {
+ dp = datapoint.datapoint
+ stats[datestamp]['datapoints'][dp]['values'][point_id] = {
'datapoint': datapoint.datapoint,
'datestamp': datestamp,
'hour': hour,
@@ -343,11 +345,20 @@ def post(self):
payment_data.save()
+class CheckTimeHandler(webapp.RequestHandler):
+ def get(self):
+ self.response.out.write(simplejson.dumps({
+ "code": 200,
+ "timestamp": int(time.mktime(datetime.now().timetuple())) * 1000
+ }))
+
+
class ClearCacheHandler(webapp.RequestHandler):
def get(self):
memcache.flush_all()
self.response.out.write("Cache cleared.")
+
application = webapp.WSGIApplication([
('/', MainPage),
('/links/add', AddLinkPage),
@@ -364,6 +375,7 @@ def get(self):
('/_ah/prospective_search', StatsHandler),
('/payments/notification', PaymentNotificationHandler),
('/cache/clear', ClearCacheHandler),
+ ('/util/time', CheckTimeHandler)
], debug=True)
Please sign in to comment.
Something went wrong with that request. Please try again.