如何在Google App Engine webapp2请求处理程序中获取HTTP标头

bog*_*gen 3 python google-app-engine http-headers

如何访问调用此方法的请求的http标头?

class GetDBVersion(webapp2.RequestHandler):
    def get(self):
# writes out db version
Run Code Online (Sandbox Code Playgroud)

在main.py中

app = webapp2.WSGIApplication([
    ('/version', GetDBVersion
      # and more methods
Run Code Online (Sandbox Code Playgroud)

spe*_*ope 6

使用webapp2.RequestHandler在类中执行此操作.

self.request.headers

它会给你一个标题的字典.