thousandeyes-sdk-python/thousandeyes-sdk-core
Kevin Han e75e6a7f2f
Some checks are pending
Python CI / build (push) Waiting to run
Fix: Upgrade to urllib3 >= 2.6.3 (#162)
* upgrade to urllib3 >= 2.6.3

* Revert auto-generated changes; keep core retry fix only

* recover tests
2026-07-13 09:29:31 +01:00
..
src/thousandeyes_sdk/core Fix: Upgrade to urllib3 >= 2.6.3 (#162) 2026-07-13 09:29:31 +01:00
test Fix: Upgrade to urllib3 >= 2.6.3 (#162) 2026-07-13 09:29:31 +01:00
pyproject.toml Fix: Upgrade to urllib3 >= 2.6.3 (#162) 2026-07-13 09:29:31 +01:00
README.md feat: Add pagination iterable helper (#125) 2026-01-26 17:18:17 +00:00

thousandeyes-sdk-core

This package provides core functionality for interacting with the ThousandEyes API and should be installed before using any of the published SDKs.

PaginationIterable is unbounded, so wrap it with itertools.islice to cap the number of items and avoid making unintended, potentially expensive API calls. Pick a slice size that matches your UI or batch size so you only fetch what you plan to process:

from thousandeyes_sdk.core import Configuration, ApiClient, PaginationIterable
from thousandeyes_sdk.dashboards import DashboardsApi
from itertools import islice

configuration = Configuration(
    host = "https://api.thousandeyes.com/v7",
    access_token = "an_access_token",
)


def get_dashboard_widget_data():
    with ApiClient(configuration) as client:
        dashboards_api = DashboardsApi(client)
        for item in list(islice(PaginationIterable(
            dashboards_api.get_dashboard_widget_data,
            lambda response: response.data.tests,
            dashboard_id="a_dashboard_id",
            widget_id="a_widget_id",
        ), 20)):
            print(item.test_id)