import osimport timefrom flareio import FlareApiClientapi_key = os.environ.get("FLARE_API_KEY")if not api_key: raise Exception("Please provide an API key")api_client = FlareApiClient(api_key=api_key)last_from: str | None = Nonefetched_pages: int = 0for resp in api_client.scroll( method="GET", url="/leaksdb/v2/sources", params={ "from": last_from, },): # Rate limiting (default). time.sleep(0.25) # Get results from the response resp_data = resp.json() items = resp_data.get("items") fetched_pages += 1 print(f"Fetched page {fetched_pages} ({last_from=}) with {len(items)} items...") # Save the last "next" value. last_from = resp_data.get("next") or last_fromprint("The last value for 'next' was", last_from)