def _determine_ip(self, request):
        if self.proxied:
            # Try to get the IP from the proxy-header
            ip = request.getHeader(self.proxy_header)
            if ip:
                return ip.split(',')[0].strip()

            if self.fail_if_not_proxied:
                e_msg = 'could not determine IP from proxy-header'
                detail = 'The proxy header is "%s"' % self.proxy_header
                hint = ('Ensure the proxy-header is right, set "proxied" to false if the service is '
                        'no longer proxied, or set "fail_if_not_proxied" to false to fallback to the client IP.')
                raise exceptions.PipedError(e_msg, detail, hint)

        return request.getClientIP()
dataset/ETHPy150Open foundit/Piped/piped/processors/web_processors.py/IPDeterminer._determine_ip/original