![](/img/trans.png)
[英]Working with Watson Assistant / Watson Conversation from Python
[英]Watson Conversation Logs by Date
我想知道是否有辦法使用 Watson Python SDK 在特定時間段內提取 Watson 對話日志? 還有沒有辦法避免在日志末尾添加分頁? 我想提取給定時間段內的所有日志。 下面是我目前使用的代碼,它為特定工作區提取日志:
import json
import watson_developer_cloud
conversation = watson_developer_cloud.ConversationV1(
username='xxxxxxxxxx',
password- 'xxxxxxxx',
version='2017-05-26'
)
response = conversation.list_logs(
workspace_id = 'xxxxxxx'
)
js = json.dumps(response,indent=2)
with open('data.txt', 'w') as outfile:
json.dump(response, outfile)
正如你在官方文檔中看到的,你可以使用filter
參數來列出日志,並且有很多選項可以使用。
過濾器: filter/string
一個可緩存的參數,將結果限制為與指定過濾器匹配的結果。 有關詳細信息,請參閱過濾器查詢參考。
響應的時間戳早於 2016-11-01T04:00:00.000Z。
response_timestamp<2016-11-01T04:00:00.000Z
所以你需要用你的response_timestamp
替換:
list_logs(workspace_id, sort=None, filter=paste here, page_limit=None, cursor=None)
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.