I am trying to get the number of peers that my node is connected to.

I am connected to INFURA endpoint:

from web3 import Web3
w3 = Web3(

print(w3.geth.admin.peers()) // Gives error

I receive following error:

ValueError: {'code': -32601, 'message': 'The method admin_peers does not exist/is not available'}

Am I doing something wrong?

I made sure I am connected by:

>>> w3.isConnected()

1 Answer 1


Following line should solve your issue:


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.