Skip to content

Better document how to set up a web3 instance #1609

@kclowes

Description

@kclowes

What was wrong?

There are many different ways to set up a web3 instance. For example:

from web3.auto import w3

from web3 import IPCProvider, Web3
w3 = Web3(IPCProvider('path/to/ipc/file.ipc'))

from web3 import WebsocketProvider, Web3
w3 = Web3(WebsocketProvider('ws://localhost:8546'))

from web3 import HTTPProvider, Web3
w3 = Web3(HTTPProvider('http://localhost:8545'))

from web3.auto.infura import w3

from web3.auto.infura.rinkeby import w3

...

But with each of these options comes certain configuration that needs to happen.

For example, web3.auto requires either an environment variable set, a local node running on mainnet, or an http provider running on localhost:8545. But you have to go to a different page in the docs to see that.

Similarly, if you are trying to connect to a local geth node over HTTP or Websockets, you need to start geth with the --rpc or --ws flag, respectively, in order to connect.

It would be nice if the docs mentioned these nuances.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions