def send(<EOL>self,<EOL>email_id,<EOL>recipient,<EOL>email_data=None,<EOL>sender=None,<EOL>cc=None,<EOL>bcc=None,<EOL>tags=[],<EOL>headers={},<EOL>esp_account=None,<EOL>locale=None,<EOL>email_version_name=None,<EOL>inline=None,<EOL>files=[],<EOL>timeout=None<EOL>):
if not email_data:<EOL><INDENT>email_data = {}<EOL><DEDENT>if isinstance(recipient, string_types):<EOL><INDENT>warnings.warn(<EOL>"<STR_LIT>",<EOL>DeprecationWarning)<EOL>recipient = {'<STR_LIT:address>': recipient}<EOL><DEDENT>payload = {<EOL>'<STR_LIT>': email_id,<EOL>'<STR_LIT>': recipient,<EOL>'<STR_LIT>': email_data<EOL>}<EOL>if sender:<EOL><INDENT>payload['<STR_LIT>'] = sender<EOL><DEDENT>if cc:<EOL><INDENT>if not type(cc) == list:<EOL><INDENT>logger.error(<EOL>'<STR_LIT>' % type(cc))<EOL><DEDENT>payload['<STR_LIT>'] = cc<EOL><DEDENT>if bcc:<EOL><INDENT>if not type(bcc) == list:<EOL><INDENT>logger.error(<EOL>'<STR_LIT>' % type(bcc))<EOL><DEDENT>payload['<STR_LIT>'] = bcc<EOL><DEDENT>if tags:<EOL><INDENT>if not type(tags) == list:<EOL><INDENT>logger.error(<EOL>'<STR_LIT>' % (type(tags)))<EOL><DEDENT>payload['<STR_LIT>'] = tags<EOL><DEDENT>if headers:<EOL><INDENT>if not type(headers) == dict:<EOL><INDENT>logger.error(<EOL>'<STR_LIT>' % (<EOL>type(headers)<EOL>)<EOL>)<EOL><DEDENT>payload['<STR_LIT>'] = headers<EOL><DEDENT>if esp_account:<EOL><INDENT>if not isinstance(esp_account, string_types):<EOL><INDENT>logger.error(<EOL>'<STR_LIT>' % (<EOL>type(esp_account)<EOL>)<EOL>)<EOL><DEDENT>payload['<STR_LIT>'] = esp_account<EOL><DEDENT>if locale:<EOL><INDENT>if not isinstance(locale, string_types):<EOL><INDENT>logger.error(<EOL>'<STR_LIT>' % (type(locale))<EOL>)<EOL><DEDENT>payload['<STR_LIT>'] = locale<EOL><DEDENT>if email_version_name:<EOL><INDENT>if not isinstance(email_version_name, string_types):<EOL><INDENT>logger.error(<EOL>'<STR_LIT>' % (<EOL>type(email_version_name)))<EOL><DEDENT>payload['<STR_LIT>'] = email_version_name<EOL><DEDENT>if inline:<EOL><INDENT>payload['<STR_LIT>'] = self._make_file_dict(inline)<EOL><DEDENT>if files:<EOL><INDENT>payload['<STR_LIT>'] = [self._make_file_dict(f) for f in files]<EOL><DEDENT>return self._api_request(<EOL>self.SEND_ENDPOINT,<EOL>self.HTTP_POST,<EOL>payload=payload,<EOL>timeout=timeout<EOL>)<EOL>
API call to send an email