def send(self, encoding="<STR_LIT>"):
self._construct_message()<EOL>if self.verbose:<EOL><INDENT>print(<EOL>"<STR_LIT>"<EOL>"<STR_LIT>"<EOL>"<STR_LIT>".format(timestamp())<EOL>)<EOL><DEDENT>if encoding == "<STR_LIT>":<EOL><INDENT>resp = requests.post(self.url, json=self.message)<EOL><DEDENT>elif encoding == "<STR_LIT:url>":<EOL><INDENT>resp = requests.post(self.url, data=self.message)<EOL><DEDENT>try:<EOL><INDENT>resp.raise_for_status()<EOL>if resp.history and resp.history[<NUM_LIT:0>].status_code >= <NUM_LIT>:<EOL><INDENT>raise MessageSendError("<STR_LIT>")<EOL><DEDENT>elif "<STR_LIT>" in resp.text:<EOL><INDENT>raise MessageSendError("<STR_LIT>")<EOL><DEDENT><DEDENT>except (requests.exceptions.HTTPError, MessageSendError) as e:<EOL><INDENT>raise MessageSendError(e)<EOL><DEDENT>if self.verbose:<EOL><INDENT>print(<EOL>timestamp(),<EOL>type(self).__name__,<EOL>"<STR_LIT>",<EOL>self.__str__(indentation="<STR_LIT>"),<EOL>"<STR_LIT>",<EOL>resp.status_code,<EOL>)<EOL><DEDENT>print("<STR_LIT>")<EOL>
Send the message via HTTP POST, default is json-encoded.