道歉,因爲唯一的網絡發展中,我所知道的是Django的/ Python的種類,且很可能犯下混合我的代碼成語(REST VS Django的URL調度工作流程)Google Glass callbackUrl來自Mirror API的POST是空的?
的我有作爲callbackUrl到一個URL處理程序訂閱我的Glassware。我得到一個處理程序的POST,但請求對象似乎是空的。
我相信我理解這個錯誤,但有人可以指示我從POST通知到callbackURL獲取「REPLY」信息的方向。
我的URL處理器是
class A600Handler(webapp2.RequestHandler):
def post(self):
"""Process the value of A600 received and return a plot"""
# I am seeing this in my logs proving that I am getting a POST when glass replies
logging.info("Received POST to logA600")
# This is returning None
my_collection = self.request.get("collection")
logging.info(my_collection)
# I also tried this but self.sequest.POST is empty '[]' and of type UnicodeMultiDict
# json_request_data = json.loads(self.request.POST)
@util.auth_required
def get(self):
"""Process the value of A600 received and return a plot"""
logging.info("Received GET to this logA600")
我有以下URL處理程序定義,可以驗證後功能得到一個「平」,當用戶通過查看應用程序引擎的日誌點擊回覆。
MAIN_ROUTES = [ ('/', MainHandler),('/logA600',A600Handler), ]
如何提取用戶發送的語音轉錄文本形式的有效載荷?我不理解The "parse_notification" example given in the docs
感謝gotgenes,evrything確實隱藏在請求主體中。正如你從django處理它的方式中指出的那樣。 request.POST.get(「key」)僅適用於基於表單的POST信息。鏡像API返回都在我上面的處理程序類中的self.request.body中。 – harijay