def handle(self, *args, **options): """ Renders the output by piecing together a few methods that do the dirty work. """ # AWS SES connection, which can be re-used for each query needed. conn = get_boto_ses_connection() self._print_quota(conn) self._print_daily_stats(conn)
def _open_ses_conn(self): """ Create a connection to the AWS API server. This can be reused for sending multiple emails. """ if self.connection: return self.connection = get_boto_ses_connection()
def _get_ses_connection(self): """ Convenience method for returning a SES connection, and handling any errors that may appear. :rtype: boto.ses.SESConnection """ try: connection = get_boto_ses_connection() return connection except: raise Exception("Could not connect to Amazon SES service")