Web3.py compatible async providers that supports multiply RPC URLs
Project description
Web3 async multi provider
Web3.py compatible async providers that supports multiply RPC URLs
This library allows to create a w3
instance with multiply RPC URLs to prevent failures when a node is down by choosing another one by cycle.
Features
- HTTP async provider
- WebSockets async provider
Overview
HTTP w3 provider
import web3
from web3_async_multi_provider import AsyncWSMultiProvider
provider = AsyncHTTPMultiProvider(
providers=[
web3.AsyncHTTPProvider("https://eth.llamarpc.com"),
web3.AsyncHTTPProvider("https://rpc.flashbots.net"),
]
)
WebSockets provider
import web3
from web3_async_multi_provider import AsyncWSMultiProvider
provider = AsyncWSMultiProvider(
providers=[
web3.providers.WebsocketProvider("wss://example.com/"),
web3.providers.WebsocketProvider("wss://google.com/"),
]
)
And then add it into Web3
:
w3 = web3.Web3(
provider
modules={"eth": [web3.eth.AsyncEth]},
middlewares=[]
)
print(await web3.eth.chain_id)
Installation
Via PyPI:
python -m pip install web3_async_multi_provider
Or via GitHub
python -m pip install https://github.com/deknowny/web3-async-multi-provider/archive/main.zip
Contributing
Check out site Contributing section
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file web3_async_multi_provider-0.1.0b0.tar.gz
.
File metadata
- Download URL: web3_async_multi_provider-0.1.0b0.tar.gz
- Upload date:
- Size: 3.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.4.2 CPython/3.9.16 Linux/5.15.0-1035-azure
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6125f0781b535b67135e9983d7faab6e3981e136c65234431f514af52dbbacf5 |
|
MD5 | b7664daa9c8aa2bacd5d2e70726adb27 |
|
BLAKE2b-256 | e32ce3deeb7cf816f756bef42daa73f2a3b5512674c81f39de616f259aa202cb |
File details
Details for the file web3_async_multi_provider-0.1.0b0-py3-none-any.whl
.
File metadata
- Download URL: web3_async_multi_provider-0.1.0b0-py3-none-any.whl
- Upload date:
- Size: 4.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.4.2 CPython/3.9.16 Linux/5.15.0-1035-azure
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 06f5ab9035b83b89170976a44d007a719b24353cae137a9d267265f9ab2c5a06 |
|
MD5 | ae67e540f6c0df52a198a9dcb00cc85a |
|
BLAKE2b-256 | 08cd1d3bdd71fed74bc5776d4bf40ccd1d4df44bb6c774476a7f6d6088df6afb |