(self, apikey=None, debug=False)
Initialize the API client

        Args:
           apikey (str|None): provide your Mandrill API key.  If this is left as None, we will attempt to get the API key from the following locations::
               - MANDRILL_APIKEY in the environment vars
               - ~/.mandrill.key for the user executing the script
               - /etc/mandrill.key
           debug (bool): set to True to log all the request and response information to the "mandrill" logger at the INFO level.  When set to false, it will log at the DEBUG level.  By default it will write log entries to STDERR
Initialize the API client
Initialize the API client
def __init__(self, apikey=None, debug=False):
        '''Initialize the API client

        Args:
           apikey (str|None): provide your Mandrill API key.  If this is left as None, we will attempt to get the API key from the following locations::
               - MANDRILL_APIKEY in the environment vars
               - ~/.mandrill.key for the user executing the script
               - /etc/mandrill.key
           debug (bool): set to True to log all the request and response information to the "mandrill" logger at the INFO level.  When set to false, it will log at the DEBUG level.  By default it will write log entries to STDERR
       '''

        self.session = requests.session()
        if debug:
            self.level = logging.INFO
        else:
            self.level = logging.DEBUG
        self.last_request = None

        if apikey is None:
            if 'MANDRILL_APIKEY' in os.environ:
                apikey = os.environ['MANDRILL_APIKEY']
            else:
                apikey = self.read_configs()

        if apikey is None: raise Error('You must provide a Mandrill API key')
        self.apikey = apikey

        self.templates = Templates(self)
        self.exports = Exports(self)
        self.users = Users(self)
        self.rejects = Rejects(self)
        self.inbound = Inbound(self)
        self.tags = Tags(self)
        self.messages = Messages(self)
        self.whitelists = Whitelists(self)
        self.ips = Ips(self)
        self.internal = Internal(self)
        self.subaccounts = Subaccounts(self)
        self.urls = Urls(self)
        self.webhooks = Webhooks(self)
        self.senders = Senders(self)
        self.metadata = Metadata(self)
def __init__ ( self , apikey = None , debug = False ) : self . session = requests . session ( ) if debug : self . level = logging . INFO else : self . level = logging . DEBUG self . last_request = None if apikey is None : if 'MANDRILL_APIKEY' in os . environ : apikey = os . environ [ 'MANDRILL_APIKEY' ] else : apikey = self . read_configs ( ) if apikey is None : raise Error ( 'You must provide a Mandrill API key' ) self . apikey = apikey self . templates = Templates ( self ) self . exports = Exports ( self ) self . users = Users ( self ) self . rejects = Rejects ( self ) self . inbound = Inbound ( self ) self . tags = Tags ( self ) self . messages = Messages ( self ) self . whitelists = Whitelists ( self ) self . ips = Ips ( self ) self . internal = Internal ( self ) self . subaccounts = Subaccounts ( self ) self . urls = Urls ( self ) self . webhooks = Webhooks ( self ) self . senders = Senders ( self ) self . metadata = Metadata ( self )