Skip to main content

So, with the old Censys API, I used the Python SDK search, with pagination.  With the new Censys Platform API Python SDK, I don’t see pagination with the search method. 

Would the new search method be able to handle very large rows of results, even though it doesn’t allow for pagination?  Do I need to use a different methodology (maybe even using the API without the SDK), to return large amounts of data?

As such, what’s considered, “large”.

 

As well, my user is in a Commercial Pro account. I used to be able to email support@censys.io , but now I get an autoresponse saying that I’m not eligable.

 

Thanks!


Hey there, pagination is supported in the Platform Python SDK. Use the page_token parameter to paginate through searches with many pages of results. A next_page_token will be output at the bottom of each page of results that you can use to start listing the next page.

You can use the page_size parameter to define the number of hits to return as well.

You can try out the API directly in the API reference guide here to get a handle on how pagination works.

Here’s an example of using pagination in the Python SDK: 

page_token = ""
hits = ]
for _ in range(3):
res = platform.global_data.search(
search_query_input_body=models.SearchQueryInputBody(
query="web.port: *",
page_size=3,
fields=d"web.port"],
page_token=page_token
)
)
hits.extend(res.result.result.hits)
page_token = res.result.result.next_page_token

print(len(hits))

The Platform Python SDK supports long rows of results.

Regarding the auto-reponse you got from emailing support, I reached out to our support team and they have resolved an issue that caused that. You should now be able to email the support email without running into the auto-responder. Let me know if you have any other questions.


Thanks! Is there a date for the retirement of the legacy search API?


We are aiming for the end of 2025 for retiring those APIs.


Reply