@@ -36,7 +36,7 @@ Supported Environment Variables:
3636* `` FAUNA_ENDPOINT `` : The Fauna endpoint to use. For example, `` http://localhost:8443 ``
3737* `` FAUNA_SECRET `` : The Fauna secret to use.
3838
39- ``` python
39+ ``` python
4040from fauna import fql
4141from fauna.client import Client
4242from fauna.encoding import QuerySuccess
@@ -280,13 +280,12 @@ for products in pages:
280280
281281## Event Streaming
282282
283- The driver supports ` Event Streaming < https://docs.fauna.com/fauna/current/learn/streaming> ` _ .
283+ The driver supports [ Event Streaming] ( https://docs.fauna.com/fauna/current/learn/streaming ) .
284284
285- _ Start a stream _
285+ ### Start a stream
286286
287287To get a stream token, append `` toStream() `` or `` changesOn() `` to a set from a
288- `supported source
289- < https://docs.fauna.com/fauna/current/reference/streaming_reference/#supported-sources > `_ .
288+ [ supported source] ( https://docs.fauna.com/fauna/current/reference/streaming_reference/#supported-sources ) .
290289
291290
292291To start and subscribe to the stream, pass the stream token to
@@ -295,20 +294,20 @@ To start and subscribe to the stream, pass the stream token to
295294``` python
296295 from fauna import fql
297296 from fauna.client import Client
298-
297+
299298 client = Client()
300-
299+
301300 response = client.query(fql('''
302301 let set = Product.all()
303302 {
304303 initialPage: set.pageSize(10),
305304 streamToken: set.toStream()
306305 }
307306 ''' ))
308-
307+
309308 initialPage = response.data[' initialPage' ]
310309 streamToken = response.data[' streamToken' ]
311-
310+
312311 client.stream(streamToken)
313312```
314313
@@ -321,7 +320,7 @@ You can also pass a query that produces a stream token directly to
321320 client.stream(query)
322321```
323322
324- _ Iterate on a stream _
323+ ### Iterate on a stream
325324
326325`` Client.stream() `` returns an iterator that emits events as they occur. You can
327326use a generator expression to iterate through the events:
@@ -343,7 +342,7 @@ with client.stream(query) as stream:
343342 # # ...
344343```
345344
346- _ Close a stream _
345+ ### Close a stream
347346
348347Use `` <stream>.close() `` to close a stream:
349348
@@ -356,12 +355,12 @@ with client.stream(query) as stream:
356355 print (' Stream event' , event)
357356 # ...
358357 count+= 1
359-
358+
360359 if (count == 2 ):
361360 stream.close()
362361```
363362
364- _ Error handling _
363+ ### Error handling
365364
366365If a non-retryable error occurs when opening or processing a stream, Fauna
367366raises a `` FaunaException `` :
383382except FaunaException as e:
384383 print (' error ocurred with stream: ' , e)
385384```
386- _ Stream options _
385+ ### Stream options
387386
388387The client configuration sets default options for the `` Client.stream() ``
389388method.
0 commit comments