webpy 获取http头head信息

2017-08-06  本文已影响0人  moodi

打印所有的头信息

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

上一篇下一篇

猜你喜欢

热点阅读