Skip to content

Commit

Permalink
updated code example & added limit
Browse files Browse the repository at this point in the history
  • Loading branch information
RomanBachaloSigmaSoftware committed Dec 26, 2023
1 parent 852d772 commit 9abbc62
Showing 1 changed file with 24 additions and 6 deletions.
30 changes: 24 additions & 6 deletions app/monitor/examples/eg001_get_monitoring_data.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from docusign_monitor import DataSetApi
from flask import session, json
from flask import session

from app.monitor.utils import create_monitor_api_client

Expand All @@ -17,7 +17,7 @@ def worker(args):
"""
1. Create an API client with headers
2. Get your monitor data via SDK
"""
"""
# Create an API client with headers
#ds-snippet-start:Monitor1Step2
api_client = create_monitor_api_client(
Expand All @@ -26,8 +26,26 @@ def worker(args):
#ds-snippet-end:Monitor1Step2
#ds-snippet-start:Monitor1Step3
dataset_api = DataSetApi(api_client=api_client)
result = dataset_api.get_stream(
data_set_name="monitor",
version="2.0")._data

cursor_value = ''
limit = 100
function_results = []
complete = False

while not complete:
cursored_results = dataset_api.get_stream(
data_set_name="monitor",
version="2.0",
limit=limit,
cursor=cursor_value
)
end_cursor = cursored_results.end_cursor

if end_cursor == cursor_value:
complete = True
else:
cursor_value = end_cursor
function_results.append(cursored_results.data)

#ds-snippet-end:Monitor1Step3
return result
return function_results

0 comments on commit 9abbc62

Please sign in to comment.