How to listen for events in Python?

Could any kind soul please share a working version of how to listen for events in Python?

I hope this is more open-ended than my SO question –

Many thanks in advance.

Hi @Jerry_Ji, a good place to start is the Python Websockets library.

Using that library along with our eth_subscribe websocket connection using the logs subscription type, should allow you to listen to events in Python!

Let us know how this works for you.

It seems web3py’s createFilter() does work with Infura websocket endpoint. I’ve updated the issue on github with –

I briefly looked into parsing logs myself but find it too much manual work duplicating createFilter