@@ -58,12 +58,12 @@ resp = client.get("/tokens/test")
5858print (resp.json())
5959```
6060
61- ## Paging Util
61+ ## Paging Util - Generic
6262
6363The ` FlareApiClient ` has a ` scroll ` method that can be used with endpoints that support the
6464[ Flare standard paging pattern <Icon icon = " book" size = { 16 } />] ( /concepts/paging ) .
6565
66- ``` python Paging Util Example
66+ ``` python Paging Util - Generic Example
6767import os
6868import time
6969
@@ -102,6 +102,45 @@ for resp in api_client.scroll(
102102print (" The last value for 'next' was" , last_from)
103103```
104104
105+ ## Paging Util - Event Feeds
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 - Event Feeds Example
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" : None ,
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
107146The ` FlareApiClient ` can be initialized with a custom ` requests.Session ` . This allows, for example,
0 commit comments