def get(self, ticket_id):
     """Get single ticket details"""
     response_object = {
         'status': 'fail',
         'message': 'Event does not exist'
     }
     try:
         t=query_ot()
         t.get(ticket_id)
         result=serialize(t.xml_result.decode("utf-8"))
         ticket=result.res
         #event = test()
         if not ticket:
             return response_object, 404
         
         wrong_type=False
         unexpected_fields = []
         for f in ticket.keys():
             if f not in ticket_model.fields:
                 unexpected_fields.append(f)
                 wrong_type=True
         if wrong_type == True:
             response_object = {
             'status': 'fail',
             'message': 'wrong object returned'
             }
             return response_object, 400
         else:
             response_object = {
                 'status': 'success',
                 'data': ticket
             }
             return response_object,200
     except ValueError:
         return response_object, 404
 def put(self):
     time.sleep(1)
     post_data = request.get_json()
     
     #if not post_data:
     #    response_object = {
     #        'status': 'fail',
     #        'message': 'Invalid payload.'
     #    }
     #   return jsonify(response_object), 400
    
     try:
         fields=getFields(event_model,post_data)
     except:
         response_object = {
             'status': 'fail',
             'message': 'Invalid payload parsing fields.'
         }
         return jsonify(response_object), 400
     try:
         r = query_ot()
         print (event_model)
         print(fields)
         event = r.add(event_model,fields)
         if event:
             response_object = {
                 'status': 'success',
                 'message': 'event was added!',
                 'event' : event
             }
             return response_object, 201
         else:
             response_object = {
                 'status': 'fail',
                 'message': 'Sorry. failed.'
             }
             return response_object, 400
     except:
         response_object = {
             'status': 'fail',
             'message': 'Invalid payload.'
         }
         return jsonify(response_object), 400
 def get(self, object_id):
     """Get single event details"""
     response_object = {
         'status': 'fail',
         'message': 'Event does not exist'
     }
     try:
         e=query_ot()
         e.get(object_id)
         print ("%s" % e.xml_result)
         result=serialize(e.xml_result.decode("utf-8"))
         ot_object=result.metadata
         if not ot_object:
             return response_object, 404
         else:
             response_object = {
                 'status': 'success',
                 'data': ot_object
             }
             return response_object, 200
     except ValueError:
         return response_object, 404