"""A page that echoes the Referrer header value via BroadcastChannel. """ def main(request, response): referrer = request.headers.get(b"referer") uid = request.GET.first(b"uid") if referrer is None: referrer = b"(none)" html = u''' Echo referrer ''' return (200, [("Content-Type", b"text/html")], html % (uid.decode("utf-8"), referrer.decode("utf-8")))