<s> try : <EOL> import boto . ses <EOL> from boto . ses import SESConnection <EOL> except ImportError : <EOL> raise ImportError ( "<STR_LIT>" ) <EOL> __all__ = [ '<STR_LIT>' ] <EOL> log = __import__ ( '<STR_LIT>' ) . getLogger ( __name__ ) <EOL> class AmazonTransport ( object ) : <EOL> __slots__ = ( '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ) <EOL> def __init__ ( self , config ) : <EOL> config [ '<STR_LIT>' ] = config . pop ( '<STR_LIT:id>' ) <EOL> config [ '<STR_LIT>' ] = config . pop ( '<STR_LIT:key>' ) <EOL> self . region = config . pop ( '<STR_LIT>' , "<STR_LIT>" ) <EOL> self . config = config <EOL> self . connection = None <EOL> def startup ( self ) : <EOL> self . connection = boto . ses . connect_to_region ( self . region , ** self . config ) <EOL> def deliver ( self , message ) : <EOL> try : <EOL> destinations = [ r . encode ( encoding = '<STR_LIT:utf-8>' ) for r in message . recipients ] <EOL> response = self . connection . send_raw_email ( str ( message ) , message . author . encode ( ) , destinations ) <EOL> return ( <EOL> response [ '<STR_LIT>' ] [ '<STR_LIT>' ] [ '<STR_LIT>' ] , <EOL> response [ '<STR_LIT>' ] [ '<STR_LIT>' ] [ '<STR_LIT>' ] <EOL> ) <EOL> except SESConnection . ResponseError : <EOL> raise <EOL> def shutdown ( self ) : <EOL> if self . connection : <EOL> self . connection . close ( ) <EOL> self . connection = None </s>
