def add_uri_handler(self, method, uri, auth, handler): """ Register a URI handler with Kismet; this will be called whenever that URI is triggered on the Kismet REST interface. A URI should be a complete path, and include the file extension. :param method: HTTP method (GET or POST) :param uri: Full URI :param auth: User login/authentication required? (Bool) :param handler: Handler function, called with http_pb2.HttpRequest object) :return: None """ if method not in self.uri_handlers: self.uri_handlers[method] = {} if uri not in self.uri_handlers[method]: self.uri_handlers[method][uri] = handler reguri = http_pb2.HttpRegisterUri() reguri.method = method reguri.uri = uri reguri.auth_required = auth self.write_ext_packet("HTTPREGISTERURI", reguri)
def add_uri_handler(self, method, uri, auth, handler): if not method in self.uri_handlers: self.uri_handlers[method] = {} if not uri in self.uri_handlers[method]: self.uri_handlers[method][uri] = handler reguri = http_pb2.HttpRegisterUri() reguri.method = method reguri.uri = uri reguri.auth_required = auth self.write_ext_packet("HTTPREGISTERURI", reguri)