def _HttpUrlLoggingWrapper(func):
    """Decorates func, logging when 'url' params do not start with https://."""
    @functools.wraps(func)
    def _CheckAndLog(*args, **kwargs):
        try:
            arg_index = find_argument_index(func, 'url')
        except ValueError:
            return func(*args, **kwargs)

        if arg_index < len(args):
            arg_value = args[arg_index]
        elif 'url' in kwargs:
            arg_value = kwargs['url']
        elif 'url' not in kwargs:
            arg_value = get_default_argument(func, 'url')

        if arg_value and not arg_value.startswith('https://'):
            logging.warn('SECURITY : fetching non-HTTPS url %r', arg_value)
        return func(*args, **kwargs)
    return _CheckAndLog
dataset/ETHPy150Open potatolondon/djangae/djangae/contrib/security/middleware.py/_HttpUrlLoggingWrapper/original