You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using containers_list_read(query_params), the function will default to limit=50 via execute_compute() method, though I pass in a limit of 1.
query_params = {"limit":1}
Expected behavior
I would expect containers_list_read(query_params) to have limit set from from the provided input and not default to 50.
Current behavior
Currently, containers_list_read() calls execute_compute() like this self.execute_compute('GET', 'api/v1/containers?', query_params=query_params, paginated=True) , which defaults to setting the url with a hardcoded limit of 50:
if paginated:
url = 'https://%s/%s?limit=%s&offset=%s' % (self.api_compute, endpoint, limit, offset)
And it returns a paginated list of 50 items until a 429 response is received (which is a separate issue)
Possible solution
limit = int(query_params.get("limit", "50")) if query_params.get("limit", "").isdigit() and 0 < int(query_params.get("limit", "50")) <= 50 else 50
The code needs to handle if query_param["limit"] is passed as an int or str.
Steps to reproduce
Instantiate a connection to your Prisma Console URL and call containers_list_read(query_parms)
Describe the bug
When using
containers_list_read(query_params)
, the function will default tolimit=50
viaexecute_compute()
method, though I pass in a limit of 1.query_params = {"limit":1}
Expected behavior
I would expect containers_list_read(query_params) to have limit set from from the provided input and not default to 50.
Current behavior
Currently, containers_list_read() calls execute_compute() like this
self.execute_compute('GET', 'api/v1/containers?', query_params=query_params, paginated=True)
, which defaults to setting the url with a hardcoded limit of 50:And it returns a paginated list of 50 items until a 429 response is received (which is a separate issue)
Possible solution
The code needs to handle if query_param["limit"] is passed as an int or str.
Steps to reproduce
Instantiate a connection to your Prisma Console URL and call containers_list_read(query_parms)
API Code Method:
https://github.com/PaloAltoNetworks/prismacloud-api-python/blob/main/prismacloud/api/cwpp/cwpp.py#L28
Line in quesetion
https://github.com/PaloAltoNetworks/prismacloud-api-python/blob/main/prismacloud/api/cwpp/cwpp.py#L50
Screenshots
Due to the nature of the results, no screenshots are provided.
Context
I can not use the SDK since I need a limit of 1 for some calls and a limit of 50 for more gets a 429 error
Your Environment
The text was updated successfully, but these errors were encountered: