def api_request(request, *args, **kwargs):
 plugin = pm.api_plugin_for_request(request)
 if (plugin and plugin.request_class):
  req = plugin.request_class(*args, **kwargs)
 else:
  raise Exception('Invalid request type')
 return req

def api_request ( request , * args , ** kwargs ) : plugin = pm . api_plugin_for_request ( request ) if ( plugin and plugin . request_class ) : req = plugin . request_class ( * args , ** kwargs ) else : raise Exception ( 'Invalid request type' ) return req
create an api request .