def handle(self, environ, start_response):
<EOL>try:<EOL><INDENT>handler = self.route(<EOL>environ['<STR_LIT>'].lower(),<EOL>environ['<STR_LIT>'].lower(),<EOL>)<EOL>if handler is None:<EOL><INDENT>raise HttpNotFound()<EOL><DEDENT><DEDENT>except HttpNotFound:<EOL><INDENT>start_response('<STR_LIT>', [('<STR_LIT:Content-Type>', '<STR_LIT:application/json>')])<EOL>return [json.dumps({"<STR_LIT:error>": "<STR_LIT>"})]<EOL><DEDENT>except HttpMethodNotAllowed:<EOL><INDENT>start_response('<STR_LIT>', [('<STR_LIT:Content-Type>', '<STR_LIT:application/json>')])<EOL>return [json.dumps({"<STR_LIT:error>": "<STR_LIT>"})]<EOL><DEDENT>body = environ['<STR_LIT>'].read()<EOL>if body:<EOL><INDENT>body = json.loads(body)<EOL><DEDENT>response = handler(<EOL>environ['<STR_LIT>'].lower(),<EOL>body,<EOL>)<EOL>start_response('<STR_LIT>', [('<STR_LIT:Content-Type>', '<STR_LIT:application/json>')])<EOL>return [json.dumps(response)]<EOL>
Main entry point