Watson会话日志(按日期) [英] Watson Conversation Logs by Date

查看:156
本文介绍了Watson会话日志(按日期)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道是否可以使用Watson Python SDK在特定时间段内提取Watson对话日志?还有办法避免在日志末尾添加分页吗?我想提取给定时间段内的所有日志.以下是我当前使用的代码,用于提取特定工作区的日志:

I wanted to know if there is a way to pull Watson conversation logs for a specific time period using Watson Python SDK? Also is there a way to avoid the pagination added at the end of the logs? I want to pull all the logs for a given time period. Below is the code I am currently using which pulls logs for a specific workspace:

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)

推荐答案

如您在

As you can see on the Official documentation, you can use the filter parameter to list logs and have a lot of options to use.

过滤器:filter/string一个可缓存的参数,将结果限制为与指定过滤器匹配的结果.有关更多信息,请参阅过滤查询参考.

Filter: filter/string A cacheable parameter that limits the results to those matching the specified filter. For more information, see Filter query reference.

响应的时间戳早于 2016-11-01T04:00:00.000Z.

The timestamp of the response is earlier than 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)

  • 使用详细了解过滤器参数日志-Watson对话.
  • 有关使用Python的日志,请参见官方API参考关于.
    • See more about the filter parameter using Logs - Watson Conversation.
    • See the Official API Reference about Logs using Python.
    • 这篇关于Watson会话日志(按日期)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆