Advertisement
wandrake

Untitled

Dec 14th, 2015 (edited)
20
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.74 KB | None | 0 0
  1. class SimulationReset(Request):
  2.  
  3.     @swagger.model
  4.     class ResetRequest(object):
  5.         """
  6.        Represents a request for the API implemented by SimulationReset
  7.        """
  8.  
  9.         resource_fields = {
  10.             'oldReset': fields.Boolean,
  11.             'robotPose': fields.Boolean,
  12.             'fullReset': fields.Boolean
  13.         }
  14.         required = ['oldReset', 'robotPose', 'fullReset']
  15.  
  16.     def put(self):
  17.         for par in SimulationReset.ResetRequest.required:
  18.             if par not in body:
  19.                 raise Exception('Missing parameter %s' % (par, ))
  20.  
  21.         for par in body:
  22.             if par not in SimulationReset.ResetRequest.resource_fields:
  23.                 raise Exception('Invalid parameter %s' % (par, ))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement