beacon-client-py-0.2.0
توضیحات
A Python Client for interacting with the Ethereum Beacon Chain API
| ویژگی | مقدار |
|---|---|
| سیستم عامل | - |
| نام فایل | beacon-client-py-0.2.0 |
| نام | beacon-client-py |
| نسخه کتابخانه | 0.2.0 |
| نگهدارنده | [] |
| ایمیل نگهدارنده | [] |
| نویسنده | Benedict Brady |
| ایمیل نویسنده | - |
| آدرس صفحه اصلی | - |
| آدرس اینترنتی | https://pypi.org/project/beacon-client-py/ |
| مجوز | - |
# beacon-client-py
A Python client for interacting with the Ethereum Beacon Chain API
[Beacon Chain API Reference](https://ethereum.github.io/beacon-APIs)
[Ethereum Consensus Specification](https://github.com/ethereum/consensus-specs/blob/dev/specs/phase0/beacon-chain.md)
[Ethereum Consensus Specification Annotated](https://eth2book.info/altair/part3)
This implementation also leans on types implemented [here](https://github.com/ralexstokes/beacon-api-client)
## Installation
```bash
pip install beacon-client-py
```
## Simple Example
```python
from beacon_client.api import BeaconChainAPI
client = BeaconChainAPI("http://localhost:5052")
client.get_headers_from_block_id(block_id="head")
```
## Streaming Example
```python
for event in client.stream_events(head=True, block=True, attestation=True):
match event.event:
case "head":
print(client.parse_head(event.data))
case "block":
print(client.parse_block(event.data))
case "attestation":
print(client.parse_attestation(event.data))
case other:
pass
```
## Development
Run the docs locally
```bash
poetry run mkdocs serve
```
Formatter
```bash
poetry run black .
```
Tests
```bash
poetry run pytest -vv
```
linter
```bash
poetry run flake8
```
_note_: requires poetry version 1.2.x or higher
نیازمندی
| مقدار | نام |
|---|---|
| >=2.28.1,<3.0.0 | requests |
| >=1.7.2,<2.0.0 | sseclient-py |
| >=3.1.9,<4.0.0 | bitstring |
| >=1.6.0,<2.0.0 | dacite |
| >=0.0.9,<0.0.10 | multiaddr |
زبان مورد نیاز
| مقدار | نام |
|---|---|
| >=3.10,<4.0 | Python |
نحوه نصب
نصب پکیج whl beacon-client-py-0.2.0:
pip install beacon-client-py-0.2.0.whl
نصب پکیج tar.gz beacon-client-py-0.2.0:
pip install beacon-client-py-0.2.0.tar.gz