def on_put(self, request, response, txn_id=None):
response.body = "<STR_LIT:{}>"<EOL>if not self._is_new(txn_id):<EOL><INDENT>response.status = falcon.HTTP_200<EOL>return<EOL><DEDENT>request.context["<STR_LIT:body>"] = request.stream.read()<EOL>try:<EOL><INDENT>events = json.loads(request.context["<STR_LIT:body>"].decode("<STR_LIT:utf-8>"))["<STR_LIT>"]<EOL><DEDENT>except(KeyError, ValueError, UnicodeDecodeError):<EOL><INDENT>response.status = falcon.HTTP_400<EOL>response.body = "<STR_LIT>"<EOL>return<EOL><DEDENT>if self.handler(EventStream(events, self.Api)):<EOL><INDENT>response.status = falcon.HTTP_200<EOL><DEDENT>else:<EOL><INDENT>response.status = falcon.HTTP_400<EOL><DEDENT>
Responds to PUT request containing events.