Skip to content

Commit e9652ea

Browse files
committed
sdk: document scroll_events
1 parent 353f3c3 commit e9652ea

2 files changed

Lines changed: 50 additions & 0 deletions

File tree

docs/changelog/overview.mdx

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,17 @@ This page lists changes to Flare's API.
1212
Release notes for the Flare Platform can be found on the [product documentation website](https://docs.flare.io/releases).
1313
</Note>
1414

15+
<Update label="2025-05-15" description="Python SDK - v1.2.0">
16+
Released version 1.2.0 of the
17+
[Python SDK <Icon icon="book" size={16} />](/sdk/python).
18+
19+
This release adds a new `scroll_events` method that can be used to retrieve events from the feed APIs
20+
without having to manage fetching events individually.
21+
22+
More information, including full examples, can be found in the
23+
[Python SDK documentation <Icon icon="book" size={16} />](/sdk/python).
24+
</Update>
25+
1526
<Update label="2025-11" description="API - November 2025">
1627
Added a [Global Search Credentials Endpoint <Icon icon="code" size={16} />](/api-reference/v4/endpoints/credentials-global-search).
1728
This new endpoint allows for searching in all of Flare's credentials and counts towards the Global Search quota.

docs/sdk/python.mdx

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,45 @@ for resp in api_client.scroll(
102102
print("The last value for 'next' was", last_from)
103103
```
104104

105+
## Paging utils with details
106+
107+
The `FlareApiClient` has a `scroll_events` method that can be used with event feeds endpoints.
108+
The advantage of this method over `scroll` is that it also automates the fetching of individual events.
109+
110+
```python Paging Util Example - With Details
111+
import datetime
112+
113+
from flareio import FlareApiClient
114+
115+
116+
api_client = FlareApiClient.from_env()
117+
118+
from_timestamp: str = (
119+
datetime.datetime.now(tz=datetime.timezone.utc) - datetime.timedelta(hours=1)
120+
).isoformat()
121+
122+
for event, next in api_client.scroll_events(
123+
method="POST",
124+
pages_url="/firework/v4/events/global/_search",
125+
events_url="/firework/v2/activities/",
126+
json={
127+
"size": 10,
128+
"order": "asc",
129+
"from": last_from,
130+
"filters": {
131+
"type": ["chat_message"],
132+
"estimated_created_at": {"gte": from_timestamp},
133+
},
134+
"query": {
135+
"type": "query_string",
136+
"query_string": "hello",
137+
},
138+
},
139+
):
140+
print(f"Full event data: {event}")
141+
print(f"The next execution could resume using from={next}")
142+
```
143+
105144
## Custom Session
106145

107146
The `FlareApiClient` can be initialized with a custom `requests.Session`. This allows, for example,

0 commit comments

Comments
 (0)