I am trying an tutorial on web3.py

so i created a profile in infura and used its project id.But it shows false always when i try web3.isConnected()

PS C:\Users\HP> python
    Python 3.6.3 (v3.6.3:2c5fed8, Oct  3 2017, 18:11:49) [MSC v.1900 64 bit (AMD64)] on win32
    Type "help", "copyright", "credits" or "license" for more information.
    >>> from web3 import Web3
    >>> infura_url = "mainnet.infura.io/v3/******************************"
    >>> web3 = Web3(Web3.HTTPProvider(infura_url))
    >>> web3.isConnected()

1 Answer 1


You need to specify how you're connecting to your endpoint in the path itself. If you want to use HTTP(S), prefix the endpoint appropriately.

>>> infura_url = "https://mainnet.infura.io/v3/<my_API_ID>"
>>> w3 = Web3(Web3.HTTPProvider(infura_url))
>>> w3.isConnected()

See the docs for more details on using HTTP(S), IPC, or websockets -> Choosing How to Connect to Your Node.

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.