This section presents basic work flow of polling events from the Firehose API.
We are going to implement the following algorithm:
- every five seconds check if there are any new events in the Firehose
- if there are any events, iterate until you read all the pages of events available, i.e. until we reach the top of the stream
- for every event print out the current deal’s data and the information about what has changed
Here is a simple
Python script that presents the idea:
Now if this script is run it starts to poll the events from Firehose API. When any deal gets updated, e.g. through a web frontend, you should see the output similar to the one below:
Refer to the Firehose API resources to see what resources are currently streamed through the Firehose API.