确定在Python中选择了哪个自定义菜单项时遇到一些麻烦。
如果我有下面的菜单,并且在通知处理代码中检索到了卡片(html = item [“html”]),我该如何实际访问id值(“verify”)?
"menuItems": [
{ "action": "CUSTOM",
"id":"verify",
"values":
[
{
"displayName": "Verify Incident",
"iconUrl": "https"
}
]
}
]
答案 0 :(得分:2)
您为自定义menuItem获得的通知应如下所示:
{
"collection": "timeline",
"itemId": "{long_id}",
"operation": "UPDATE",
"userToken": "{userToken}",
"userActions": [
{
"type": "CUSTOM",
"payload": "verify"
}
]
}
payload
返回您为menuItem指定的ID。
另见这些链接: https://developers.google.com/glass/develop/mirror/subscriptions#custom_menu_item_selected https://developers.google.com/glass/develop/mirror/menu-items#defining_custom_menu_items