简体   繁体   中英

Watson Conversation Logs by Date

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: filter/string A cacheable parameter that limits the results to those matching the specified filter. For more information, see Filter query reference.

The timestamp of the response is earlier than 2016-11-01T04:00:00.000Z.

 response_timestamp<2016-11-01T04:00:00.000Z

So you need to replace with your response_timestamp :

list_logs(workspace_id, sort=None, filter=paste here, page_limit=None, cursor=None)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM