def get_outgoing_url(url):
 if (not settings.REDIRECT_URL):
  return url
 parsed_url = urlparse(url)
 url_netloc = parsed_url.netloc
 if (parsed_url.scheme not in ['http', 'https']):
  return '/'
 if ((url_netloc == urlparse(settings.REDIRECT_URL).netloc) or (url_netloc in settings.REDIRECT_URL_ALLOW_LIST)):
  return url
 url = force_bytes(jinja2.utils.Markup(url).unescape())
 sig = hmac.new(settings.REDIRECT_SECRET_KEY, msg=url, digestmod=hashlib.sha256).hexdigest()
 return '/'.join([settings.REDIRECT_URL.rstrip('/'), sig, urllib.quote(url, safe='/&=')])

def get_outgoing_url ( url ) : if ( not settings . REDIRECT_URL ) : return url parsed_url = urlparse ( url ) url_netloc = parsed_url . netloc if ( parsed_url . scheme not in [ 'http' , 'https' ] ) : return '/' if ( ( url_netloc == urlparse ( settings . REDIRECT_URL ) . netloc ) or ( url_netloc in settings . REDIRECT_URL_ALLOW_LIST ) ) : return url url = force_bytes ( jinja2 . utils . Markup ( url ) . unescape ( ) ) sig = hmac . new ( settings . REDIRECT_SECRET_KEY , msg = url , digestmod = hashlib . sha256 ) . hexdigest ( ) return '/' . join ( [ settings . REDIRECT_URL . rstrip ( '/' ) , sig , urllib . quote ( url , safe = '/&=' ) ] )
bounce a url off an outgoing url redirector .