【发布时间】:2010-12-02 18:12:31
【问题描述】:
当您像这样调用网络服务时:
username = 'test12'
password = 'test34'
client = httplib2.Http(".cache")
client.add_credentials(username,password)
URL = "http://localhost:8080/wyWebServiceTest"
response, content = client.request(URL)
如何将用户名/密码放入服务器端的变量中(即在我正在编写的 Web 服务中)。 我检查了 self.request.headers 和 self.request.environ 并找不到它们。
(我没有使用 Google 登录,需要针对我自己的数据库退回此用户 ID/通行证以验证安全性。)
我试图从这个页面获得想法:http://pythonpaste.org/webob/reference.html#headers
谢谢,
尼尔·沃尔特斯
对以下 Peter 的代码稍作改进:
auth = None
if 'Authorization' in self.request.headers:
auth = self.request.headers['Authorization']
if not auth:
【问题讨论】:
标签: python google-app-engine web-applications