I'm trying to get all events from contract, but get error:
"ValueError: {'code': -32601, 'message': 'The method eth_newFilter does not exist/is not available'}"
I'm using Web3py and Infura. My code:
myfilter = <myContract>.events.<MyEvent>.createFilter(fromBlock=0)
or
myFilter = web3.eth.filter({"address": <myContractAddress>})
Why is this error? How do I get events?
Help me please.
Best Answer
The issue is that Infura only exposes the
eth_newFilter
endpoint via websockets, but you are connecting via https.Try using a
WebsocketProvider
when declaring yourweb3
instance, as shown in the following example: