Python Example
Install socket.io for Python:
pip install "python-socketio[client]"
The simple example below creates a socket.io client, connects to our server and prints all articles as they are received.
import socketio
sio = socketio.Client()
@sio.on('connect')
def on_connect():
print("Connected to Newsfilter Stream API")
@sio.on('articles')
def on_articles(articles):
print(articles)
sio.connect('http://stream.newsfilter.io?apiKey=YOUR_API_KEY')
sio.wait()
Learn more about socket.io for Python here: https://python-socketio.readthedocs.io/en/latest/client.html