(self, sendgrid_api_key=None, *args, **kwargs)
we will provide to ways to configure clients :
         - One, you can configure plivo keys from settings if not,
         - Then Second, you ca send keys as function arguments too,
         - Priority wil be given to function arguments

        :param sendgrid_api_key: SendGrid API key
we will provide to ways to configure clients :
         - One, you can configure plivo keys from settings if not,
         - Then Second, you ca send keys as function arguments too,
         - Priority wil be given to function arguments
we will provide to ways to configure clients : - One you can configure plivo keys from settings if not - Then Second you ca send keys as function arguments too - Priority wil be given to function arguments
def __init__(self, sendgrid_api_key=None, *args, **kwargs):
        """
        we will provide to ways to configure clients :
         - One, you can configure plivo keys from settings if not,
         - Then Second, you ca send keys as function arguments too,
         - Priority wil be given to function arguments

        :param sendgrid_api_key: SendGrid API key
        """
        super(SendGridProvider, self).__init__(*args, **kwargs)

        self.sendgrid_api_key = sendgrid_api_key

        # validate necessary settings are configured by user for SendGrid
        # first we will check have user sent sendgrid api key via function
        # argument if not then we will check
        # env variable if both of them are not present then raise error.
        if self.sendgrid_api_key is None:
            self.sendgrid_api_key = getattr(settings, 'SENDGRID_API_KEY', None)

        if self.sendgrid_api_key is None:
            raise RuntimeWarning(
                'to send emails via {0} you need to configure sendgrid api \n'
                'key.Either send them as function argument via key \n'
                '`sendgrid_api_key` or set up env variable \n'
                'as `SENDGRID_API_KEY`.'.format(self.name)
            )

        # validate notification_type w.r.t Provider notify_type
        self._validate_notification_type_with_provider(self.notification_type)
        self.notify()
def __init__ ( self , sendgrid_api_key = None , * args , * * kwargs ) : super ( SendGridProvider , self ) . __init__ ( * args , * * kwargs ) self . sendgrid_api_key = sendgrid_api_key # validate necessary settings are configured by user for SendGrid # first we will check have user sent sendgrid api key via function # argument if not then we will check # env variable if both of them are not present then raise error. if self . sendgrid_api_key is None : self . sendgrid_api_key = getattr ( settings , 'SENDGRID_API_KEY' , None ) if self . sendgrid_api_key is None : raise RuntimeWarning ( 'to send emails via {0} you need to configure sendgrid api \n' 'key.Either send them as function argument via key \n' '`sendgrid_api_key` or set up env variable \n' 'as `SENDGRID_API_KEY`.' . format ( self . name ) ) # validate notification_type w.r.t Provider notify_type self . _validate_notification_type_with_provider ( self . notification_type ) self . notify ( )