-
Notifications
You must be signed in to change notification settings - Fork 138
Remove harcoded first value when getting all indicators #796
Remove harcoded first value when getting all indicators #796
Conversation
|
Hi @jorgeacjitx, |
Yes, @yassine-ouaamou the problem is that the pre-commit hook is reformatting my code again. I just skipped the pre-commit hook and now the formatting looks good. Please look at the formatting pre-commit hook because it's not working fine. |
| with_pagination = kwargs.get("withPagination", False) | ||
| with_files = kwargs.get("withFiles", False) | ||
| if get_all: | ||
| first = 100 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you take "first" value when present and keep 100 as default when "fisrt" is not present ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @aHenryJard,
The param "first" has a default value of 500:
| first = kwargs.get("first", 500) |
When the "get_all" param is true, it is still used for querying (L121):
client-python/pycti/entities/opencti_indicator.py
Lines 109 to 121 in 58a624b
| if get_all: | |
| final_data = [] | |
| data = self.opencti.process_multiple(result["data"]["indicators"]) | |
| final_data = final_data + data | |
| while result["data"]["indicators"]["pageInfo"]["hasNextPage"]: | |
| after = result["data"]["indicators"]["pageInfo"]["endCursor"] | |
| self.opencti.app_logger.info("Listing Indicators", {"after": after}) | |
| result = self.opencti.query( | |
| query, | |
| { | |
| "filters": filters, | |
| "search": search, | |
| "first": first, |
aHenryJard
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested locally all good for me, thank you.
Proposed changes
Related issues
firstparameter is not customizable when using thegetAlloption inlistmethod #457Checklist
Further comments
If this is a relatively large or complex change, kick off the discussion by explaining why you chose the solution you did and what alternatives you considered, etc...