如何在Python中检查传入Google Appengine请求的HTTP标头?

Fra*_*ank 2 python google-app-engine

我在Google Appengine上安装了一个在Python代码上运行的应用程序.它有一个请求处理程序和一个内置数据库,我通过这样的方式更新:

http://appname.appspot.com/?type=update&service=test_name&url= ..........

如果访问python应用程序的客户端具有某个HTTP标头,并且退回所有其他请求,我只希望数据库更新.如何请求HTTP标头列表并检查列表中是否包含某个标头字符串?

Dav*_*ith 6

请参阅http://code.google.com/appengine/docs/python/tools/webapp/requestclass.html#Request_headers

基本上

self.request.headers
Run Code Online (Sandbox Code Playgroud)

是一个类似字典的对象,用于保存请求标头.