Exemple #1
0
 def post(self):
     """
     Create single ip data record
     """
     if request.method != 'POST':
         abort(405)
     # check and add create time
     data = dt.check_create(request.get_json())
     # write to database
     result = database.create_one(self.collection, data)
     if result:
         return "Create success! ID:" + str(result), 201
     else:
         return "Create failed!", 417
Exemple #2
0
 def post(self):
     """
     Create single control frame data record
     """
     if request.method != 'POST':
         abort(405)
     # check and add create time
     insert_data = dt.check_create(request.get_json())
     # write to database
     result = database.create_one(self.collection, insert_data)
     if result:
         return "Create success! ID:" + str(
             result), 201  # DOTO: check result using 'str' or 'repr'
     else:
         return "Create failed!", 417