Skip to content

Is there a way to paginate get_detect_summaries? #1111

Answered by jshcodes
brucelourenco asked this question in Q&A
Discussion options

You must be logged in to vote

Here's a quick example. 😄

import logging
from concurrent.futures import ThreadPoolExecutor
from falconpy import Detects


def get_detects_details(detect_list: list):
    return falcon.get_detect_summaries(ids=detect_list)["body"]["resources"]

logging.basicConfig(level=logging.DEBUG)

falcon = Detects(debug=True)  # Pass client_id and client_secret if they are not in your environment

offset = 0
limit = 9999
detection_ids = []

while True:
    result = falcon.query_detects(offset=offset, limit=limit)["body"]
    total = result["meta"]["pagination"]["total"]
    offset = result["meta"]["pagination"]["offset"]
    detection_ids.extend(result["resources"])
    if len(detection_ids) >= total:…

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@jshcodes
Comment options

Answer selected by jshcodes
@brucelourenco
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
detects Detections issues and questions
2 participants