These are the main concepts regarding programmatic connections to Ethereum.

You use Infura to access Ethereum node via API.

Step 1: Sign up on Infura and get the API endpoint.

https://mainnet.infura.io/v3/397e0ef1xxx'

Step 2: Connect to Web3

1
2
3
4
from web3 import Web3
infura_url='https://mainnet.infura.io/v3/397e0ef1b1dd4f6e85b10c3936724da3'
w3 = Web3(Web3.HTTPProvider(infura_url))
w3.isConnected()

That’s it! You’re connected to an Ethereum node.