Exemplo n.º 1
0
def gen_body_redirect(code, location):
    from lxml.html.builder import E
    from lxml.html import tostring
    return tostring(
        E.HTML(
            E.HEAD(
                E.meta(
                    **{
                        "http-equiv": "content-type",
                        "content": "text/html;charset=utf-8",
                    }),
                E.TITLE(code),
            ),
            E.BODY(
                E.H1(code),
                E.P("The document has moved"),
                E.A("here", HREF=location),
                ".",
            )))