美文网首页
webpy 获取http头head信息

webpy 获取http头head信息

作者: moodi | 来源:发表于2017-08-06 19:03 被阅读0次

    打印所有的头信息

    for k, v in web.ctx.env.items():
            print(k,v)
    

    获取某条头信息

    ct = web.ctx.env.get('CONTENT_TYPE')
    
    import web
    urls = (
      '/', 'index',
    )
    app = web.application(urls, globals())
    render = web.template.render('templates/')
    class index:
        def GET(self):
            return ('name')
        def POST(self):
            i = web.data()
            for k, v in web.ctx.env.items():
                print(k,v)
            ct = web.ctx.env.get('fdsfdsf')
            b = str(i, encoding="utf-8")
            print(b,ct)
            return  b
    
    if __name__ == "__main__":
        app.run()
    

    推荐一个linux命令行网站:https://rootopen.com

    相关文章

      网友评论

          本文标题:webpy 获取http头head信息

          本文链接:https://www.haomeiwen.com/subject/jirnlxtx.html