Python SDK Example
from flareio import FlareApiClient from flareio.ratelimit import Limiter api_client = FlareApiClient.from_env() limiter = Limiter.from_seconds(1) last_from: str | None = None fetched_pages: int = 0 for resp in api_client.scroll( method="GET", url="/firework/v2/me/feed/credentials", params={ "from": last_from, "order_type": "asc", }, ): # Rate limiting. limiter.tick() resp_data: dict = resp.json() fetched_pages += 1 num_results: int = len(resp_data["items"]) print(f"Fetched page {fetched_pages} with {num_results} results...") # Save the last "next" value. last_from = resp_data.get("next") or last_from for item in resp_data["items"]: print(item) print(f"The next execution could resume using {last_from=}.")
Was this page helpful?