Skip to content

Commit 8f95e6c

Browse files
committed
chore: Added total parameter to the Query object
1 parent 774628d commit 8f95e6c

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

censys/search/v2/api.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,9 @@ class Query(Iterable):
100100
For more details, see our documentation: https://search.censys.io/api
101101
"""
102102

103+
# Total number of results (Set after first query)
104+
total: Optional[int] = None
105+
103106
def __init__(
104107
self,
105108
api: "CensysSearchAPIv2",
@@ -162,8 +165,9 @@ def __call__(self, per_page: Optional[int] = None) -> List[dict]:
162165
)
163166
self.page += 1
164167
result = payload["result"]
168+
self.total = result["total"]
165169
self.nextCursor = result["links"].get("next")
166-
if result["total"] == 0 or not self.nextCursor:
170+
if self.total == 0 or not self.nextCursor:
167171
self.pages = 0
168172
return result["hits"]
169173

0 commit comments

Comments
 (0)