Skip to content

[BUG] API len(cb.select(Sensor)) causes error when >1000 sensors #301

@atchutameka

Description

@atchutameka

I am getting errors using select(Sensor) API, requiring paging for >1000

  • OS: Not applicable
  • Carbon Black Product: [Carbon Black EDR]
  • Python Version: 3.8

Describe the bug
I use cb.select(Sensor) to acquire a count of sensors using the API, I get an error if there are >1000 sensors. I would like to use released code rather than patching the SDK. Can you please provide a release that has SensorPaginatedQuery enabled? Thanks

why is SensorPaginatedQuery disabled here

Steps to Reproduce
Steps to reproduce the behavior (Provide a log message if relevant):

  1. use the API len(cb.select(Sensor))
  2. See error "Unpaged request has #### results, exceeds limit of 1000. Please consider using paging."

Expected behavior
To get the count, it should use the paging ({"start":0,"end":0}) to get the count.

Additional context
Applying the following change to the models.py fixes the issue. Is there a release that has paging enabled for Sensor query?

% diff -u response/models.py.orig response/models.py
--- response/models.py.orig	2021-12-13 09:18:32.000000000 -0600
+++ response/models.py	2021-12-13 09:18:51.000000000 -0600
@@ -658,7 +658,7 @@
         #     return SensorPaginatedQuery(cls, cb)
         # else:
         #     return SensorQuery(cls, cb)
-        return SensorQuery(cls, cb)
+        return SensorPaginatedQuery(cls, cb)
 
     @property
     def group(self):

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions