Docs · guide · Python

web3.py with FlexYield

HTTPProvider with request headers.

Install

pip install web3

Connect and call

from web3 import Web3

w3 = Web3(Web3.HTTPProvider(
    "https://flexyield.io/rpc/eth_mainnet",
    request_kwargs={"headers": {"Authorization": "Bearer fy_your_api_key"}},
))

print(w3.eth.block_number)

Replace fy_your_api_key with a key from your dashboard (free tier at registration). Chain slugs: eth_mainnet base_mainnet arbitrum_one optimism_mainnet polygon_pos solana_mainnet — each has its own measured page.

Notes

All guides: integration guides · methods and limits · docs.