From the docs:
How Automated Detection Works
Web3 attempts to connect to nodes in the following order, using the first succesful connection it can make:
The docs are getting a bit stale, but should be a good place to start. I just noticed it is missing the WebsocketProvider
, which is attempted after HTTPProvider
. In the end, the best documentation is the code. For example, IPCProvider
's default location is set using:
def get_default_ipc_path(testnet=False):
if testnet:
testnet = "testnet"
else:
testnet = ""
if sys.platform == 'darwin':
ipc_path = os.path.expanduser(os.path.join(
"~",
"Library",
"Ethereum",
testnet,
"geth.ipc"
))
if os.path.exists(ipc_path):
return ipc_path
ipc_path = os.path.expanduser(os.path.join(
"~",
"Library",
"Application Support",
"io.parity.ethereum",
"jsonrpc.ipc"
))
if os.path.exists(ipc_path):
return ipc_path
elif sys.platform.startswith('linux') or sys.platform.startswith('freebsd'):
ipc_path = os.path.expanduser(os.path.join(
"~",
".ethereum",
testnet,
"geth.ipc"
))
if os.path.exists(ipc_path):
return ipc_path
ipc_path = os.path.expanduser(os.path.join(
"~",
".local",
"share",
"io.parity.ethereum",
"jsonrpc.ipc"
))
if os.path.exists(ipc_path):
return ipc_path
elif sys.platform == 'win32':
ipc_path = os.path.join(
"\\\\",
".",
"pipe",
"geth.ipc"
)
if os.path.exists(ipc_path):
return ipc_path
ipc_path = os.path.join(
"\\\\",
".",
"pipe",
"jsonrpc.ipc"
)
if os.path.exists(ipc_path):
return ipc_path