# 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.
![PyPI - Python Version](https://img.shields.io/pypi/pyversions/web3_async_multi_provider)
![PyPI - Implementation](https://img.shields.io/pypi/implementation/web3_async_multi_provider)
![PyPI](https://img.shields.io/pypi/v/web3_async_multi_provider)
[![Coverage Status](https://coveralls.io/repos/github/deknowny/web3-async-multi-provider/badge.svg?branch=main)](https://coveralls.io/github/deknowny/web3-async-multi-provider?branch=main)
***
# Features
* HTTP async provider
* WebSockets async provider
## Overview
HTTP w3 provider
```python
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
```python
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`:
```python
w3 = web3.Web3(
provider
modules={"eth": [web3.eth.AsyncEth]},
middlewares=[]
)
print(await web3.eth.chain_id)
```
# Installation
Via PyPI:
```shell
python -m pip install web3_async_multi_provider
```
Or via GitHub
```shell
python -m pip install https://github.com/deknowny/web3-async-multi-provider/archive/main.zip
```
# Contributing
Check out [site Contributing section](https://deknowny.github.io/web3-async-multi-provider/latest/contributing/)
Raw data
{
"_id": null,
"home_page": "https://github.com/deknowny/web3-async-multi-provider",
"name": "web3-async-multi-provider",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.8,<4.0",
"maintainer_email": "",
"keywords": "web3,async,multi,provider",
"author": "Kurbatov Yan",
"author_email": "deknowny@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/e3/2c/e3deeb7cf816f756bef42daa73f2a3b5512674c81f39de616f259aa202cb/web3_async_multi_provider-0.1.0b0.tar.gz",
"platform": null,
"description": "# Web3 async multi provider\n> Web3.py compatible async providers that supports multiply RPC URLs\n\nThis 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.\n\n![PyPI - Python Version](https://img.shields.io/pypi/pyversions/web3_async_multi_provider)\n![PyPI - Implementation](https://img.shields.io/pypi/implementation/web3_async_multi_provider)\n![PyPI](https://img.shields.io/pypi/v/web3_async_multi_provider)\n[![Coverage Status](https://coveralls.io/repos/github/deknowny/web3-async-multi-provider/badge.svg?branch=main)](https://coveralls.io/github/deknowny/web3-async-multi-provider?branch=main)\n***\n\n# Features\n* HTTP async provider\n* WebSockets async provider\n## Overview\nHTTP w3 provider\n```python\nimport web3\nfrom web3_async_multi_provider import AsyncWSMultiProvider\n\n\nprovider = AsyncHTTPMultiProvider(\n providers=[\n web3.AsyncHTTPProvider(\"https://eth.llamarpc.com\"),\n web3.AsyncHTTPProvider(\"https://rpc.flashbots.net\"),\n ]\n)\n```\n\nWebSockets provider\n```python\nimport web3\nfrom web3_async_multi_provider import AsyncWSMultiProvider\n\n\nprovider = AsyncWSMultiProvider(\n providers=[\n web3.providers.WebsocketProvider(\"wss://example.com/\"),\n web3.providers.WebsocketProvider(\"wss://google.com/\"),\n ]\n)\n```\n\nAnd then add it into `Web3`:\n```python\nw3 = web3.Web3(\n provider\n modules={\"eth\": [web3.eth.AsyncEth]},\n middlewares=[]\n)\nprint(await web3.eth.chain_id)\n```\n\n# Installation\nVia PyPI:\n```shell\npython -m pip install web3_async_multi_provider\n```\nOr via GitHub\n```shell\npython -m pip install https://github.com/deknowny/web3-async-multi-provider/archive/main.zip\n```\n# Contributing\nCheck out [site Contributing section](https://deknowny.github.io/web3-async-multi-provider/latest/contributing/)\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Web3.py compatible async providers that supports multiply RPC URLs",
"version": "0.1.0b0",
"split_keywords": [
"web3",
"async",
"multi",
"provider"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "08cd1d3bdd71fed74bc5776d4bf40ccd1d4df44bb6c774476a7f6d6088df6afb",
"md5": "ae67e540f6c0df52a198a9dcb00cc85a",
"sha256": "06f5ab9035b83b89170976a44d007a719b24353cae137a9d267265f9ab2c5a06"
},
"downloads": -1,
"filename": "web3_async_multi_provider-0.1.0b0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "ae67e540f6c0df52a198a9dcb00cc85a",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.8,<4.0",
"size": 4078,
"upload_time": "2023-04-16T19:34:52",
"upload_time_iso_8601": "2023-04-16T19:34:52.796846Z",
"url": "https://files.pythonhosted.org/packages/08/cd/1d3bdd71fed74bc5776d4bf40ccd1d4df44bb6c774476a7f6d6088df6afb/web3_async_multi_provider-0.1.0b0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "e32ce3deeb7cf816f756bef42daa73f2a3b5512674c81f39de616f259aa202cb",
"md5": "b7664daa9c8aa2bacd5d2e70726adb27",
"sha256": "6125f0781b535b67135e9983d7faab6e3981e136c65234431f514af52dbbacf5"
},
"downloads": -1,
"filename": "web3_async_multi_provider-0.1.0b0.tar.gz",
"has_sig": false,
"md5_digest": "b7664daa9c8aa2bacd5d2e70726adb27",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.8,<4.0",
"size": 3667,
"upload_time": "2023-04-16T19:34:54",
"upload_time_iso_8601": "2023-04-16T19:34:54.251043Z",
"url": "https://files.pythonhosted.org/packages/e3/2c/e3deeb7cf816f756bef42daa73f2a3b5512674c81f39de616f259aa202cb/web3_async_multi_provider-0.1.0b0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-04-16 19:34:54",
"github": true,
"gitlab": false,
"bitbucket": false,
"github_user": "deknowny",
"github_project": "web3-async-multi-provider",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "web3-async-multi-provider"
}