[Ethereum] Cannot create filter on Infura via web3.py

filtersinfuraweb3.py

I have an Infura account and I have the following code:

...
web3 = Web3(HTTPProvider("https://ropsten.infura.io/mytoken") )
web3_pending_filter = web3.eth.filter('pending')
...

when line web3_pending_filter = web3.eth.filter('pending') executes, I get error:

requests.exceptions.HTTPError: 405 Client Error: Method Not Allowed
for url: https://ropsten.infura.io/mytoken

How can I fix this issue?

Best Answer

Infura doesn't support filters.

Per https://api.infura.io/v1/jsonrpc/ropsten/methods (from the documentation, these are the supported methods:

{
  "get": [
    "web3_clientVersion",
    "net_version",
    "net_listening",
    "net_peerCount",
    "eth_protocolVersion",
    "eth_syncing",
    "eth_mining",
    "eth_hashrate",
    "eth_gasPrice",
    "eth_accounts",
    "eth_blockNumber",
    "eth_getBalance",
    "eth_getStorageAt",
    "eth_getTransactionCount",
    "eth_getBlockTransactionCountByHash",
    "eth_getBlockTransactionCountByNumber",
    "eth_getUncleCountByBlockHash",
    "eth_getUncleCountByBlockNumber",
    "eth_getCode",
    "eth_call",
    "eth_estimateGas",
    "eth_getBlockByHash",
    "eth_getBlockByNumber",
    "eth_getTransactionByHash",
    "eth_getTransactionByBlockHashAndIndex",
    "eth_getTransactionByBlockNumberAndIndex",
    "eth_getTransactionReceipt",
    "eth_getUncleByBlockHashAndIndex",
    "eth_getUncleByBlockNumberAndIndex",
    "eth_getCompilers",
    "eth_getLogs",
    "eth_getWork"
  ],
  "post": [
    "eth_sendRawTransaction",
    "eth_call",
    "eth_estimateGas",
    "eth_submitWork",
    "eth_submitHashrate"
  ]
}
Related Topic