-
Notifications
You must be signed in to change notification settings - Fork 131
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
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. |
@@ -63,8 +63,6 @@ def list(self, **kwargs): | |||
get_all = kwargs.get("getAll", False) | |||
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, |
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
first
parameter is not customizable when using thegetAll
option inlist
method #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...