コード例 #1
0
 def __init__(self, *args, **kwargs):
     esp_name = self.esp_name
     self.sample_setting = get_anymail_setting('sample_setting', esp_name=esp_name,
                                               kwargs=kwargs, allow_bare=True)
     self.username = get_anymail_setting('username', esp_name=esp_name, kwargs=kwargs,
                                         default=None, allow_bare=True)
     self.password = get_anymail_setting('password', esp_name=esp_name, kwargs=kwargs,
                                         default=None, allow_bare=True)
     super(SettingsTestBackend, self).__init__(*args, **kwargs)
コード例 #2
0
 def __init__(self, api_url, **kwargs):
     """Init options from Django settings"""
     self.api_url = api_url
     self.timeout = get_anymail_setting('requests_timeout',
                                        kwargs=kwargs,
                                        default=30)
     super(AnymailRequestsBackend, self).__init__(**kwargs)
     self.session = None
コード例 #3
0
ファイル: checks.py プロジェクト: tiltec/django-anymail
def check_insecure_settings(app_configs, **kwargs):
    errors = []

    # anymail.W002: DEBUG_API_REQUESTS can leak private information
    if get_anymail_setting("debug_api_requests",
                           default=False) and not settings.DEBUG:
        errors.append(
            checks.Warning(
                "You have enabled the ANYMAIL setting DEBUG_API_REQUESTS, which can "
                "leak API keys and other sensitive data into logs or the console.",
                hint=
                "You should not use DEBUG_API_REQUESTS in production deployment.",
                id="anymail.W002",
            ))

    return errors