1

Here is the code I have:

from web3 import Web3

infura_url = 'https://infura.io/project/MyProjectID'
web3 = Web3(Web3.HTTPProvider(infura_url))

print(web3.isConnected())

The problem is that it returns False and I don't know why. Any ideas what I might do wrong?

1 Answer 1

1

You must abide by the latest url format. Your code should look as follows:

from web3 import Web3

infura_url = 'mainnet.infura.io/v3/MyProjectID'
web3 = Web3(Web3.HTTPProvider(infura_url))

print(web3.isConnected())
3

Your Answer

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

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