Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug in Process.py function "list_process_work_items" #1095

Open
gio1984 opened this issue Sep 21, 2023 · 1 comment
Open

Bug in Process.py function "list_process_work_items" #1095

gio1984 opened this issue Sep 21, 2023 · 1 comment
Labels
enhancement Improve an existing feature

Comments

@gio1984
Copy link

gio1984 commented Sep 21, 2023

The function list_process_work_items doesn't retrieve all work items if they are more than 100. Additionally, it applies the filter after the request, so if it searches for "FAILED" items and the first 100 work items are all in the "COMPLETED" state, it will return an empty list. The API documentation says that the maximum value for "size" is 100 and to use "cursor" to retrieve the next pages. (https://robocorp.com/docs/control-room/apis-and-webhooks/api/process)

Probably, it could be fixed like this:
data = None
while True:
response = requests.get(url=url_list_workitems, params=params, headers=calls_headers)
response_json = response.json()
if data == None:
data = response_json["data"]
else:
data = data + response_json["data"]
if response_json["nextCursor"] == None:
break
else:
params["cursor"]= response_json["nextCursor"]

@cmin764 cmin764 added the enhancement Improve an existing feature label Oct 26, 2023
@cmin764 cmin764 added this to Pending in RPA Framework via automation Oct 26, 2023
@cmin764
Copy link
Member

cmin764 commented Oct 26, 2023

Hi and thx for the report. Indeed, our RPA Framework Process library doesn't support pagination and server-side filtering, but your proposal looks valuable, so we'd be happy if you can help us with a PR. (here's our Dev Guide to get started)


Meanwhile, we just released a new API and we're working on wrapping it into a Python client in Robo, but this will take some time until it gets released and even backported here as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Improve an existing feature
Projects
Development

No branches or pull requests

2 participants