Skip to content

Latest commit

 

History

History
53 lines (41 loc) · 1.18 KB

File metadata and controls

53 lines (41 loc) · 1.18 KB
# Synchronous Example
from censys_platform import SDK


with SDK(
    organization_id="11111111-2222-3333-4444-555555555555",
    personal_access_token="<YOUR_BEARER_TOKEN_HERE>",
) as sdk:

    res = sdk.global_data.search(search_query_input_body={
        "fields": [
            "host.ip",
        ],
        "page_size": 1,
        "query": "host.services: (protocol=SSH and not port: 22)",
    })

    # Handle response
    print(res)

The same SDK client can also be used to make asynchronous requests by importing asyncio.

# Asynchronous Example
import asyncio
from censys_platform import SDK

async def main():

    async with SDK(
        organization_id="11111111-2222-3333-4444-555555555555",
        personal_access_token="<YOUR_BEARER_TOKEN_HERE>",
    ) as sdk:

        res = await sdk.global_data.search_async(search_query_input_body={
            "fields": [
                "host.ip",
            ],
            "page_size": 1,
            "query": "host.services: (protocol=SSH and not port: 22)",
        })

        # Handle response
        print(res)

asyncio.run(main())