我有这段代码,它向我的服务器发送一个请求,该服务器由以下人员运行web.py
:
url = "https://sample.com/api"
auth_string = 'Basic ' + base64.encodestring('%s:%s' % ("usernamexxxx", "codexxxx"))[:-1]
headers = {"Content-Type": "application/json", "authorization": auth_string}
data = {"message":"WELCOME!..."}
req = urlfetch.fetch(url, method=urlfetch.POST, payload= simplejson.dumps(data), headers= headers)
response = req.content
所以当我在我的网络服务器中收到这种请求时,我想检查输入到请求的用户名和代码是否有效?以及如何访问上面代码的给定数据?