Exemplo n.º 1
0
 def get(self):
     kwargs = dict()
     tags = list()
     for key in self.request.arguments:
         kwargs[key] = self.get_argument(key)
     coll = AndroidTagsCollection('meta')
     docs = coll.find(kwargs).sort([("timestamp", -1)])
     for doc in docs:
         tags.append(doc)
     self.write(JSONEncoder().encode(tags))
Exemplo n.º 2
0
 def post(self):
     r = dict()
     kwargs = dict()
     for key in self.request.arguments:
         kwargs[key] = self.get_argument(key)
     if 'product_name' not in kwargs:
         r['msg'] = "error: need product_name!"
     if 'git_tag' not in kwargs:
         r['msg'] = "error: need git_tag!"
     if 'msg' not in r:
         timestamp = int(time.time())
         dateArray = datetime.datetime.utcfromtimestamp(timestamp) + datetime.timedelta(hours=8)
         otherStyleTime = dateArray.strftime("%Y-%m-%d %H:%M:%S")
         kwargs['timestamp'] = timestamp
         kwargs['time'] = otherStyleTime
         coll = AndroidTagsCollection('meta')
         coll.insert_one(kwargs)
         r['msg'] = 'success'
     self.write(r)