sit0 / aioetherscan

Etherscan API async Python wrapper

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

aioetherscan

PyPi License Build Coveralls Versions

Etherscan.io API async Python non-official wrapper. Tested with Python 3.10.

Features

API modules

Supports all API modules:

Also provides 3rd party utils module, which allows to fetch a lot of transactions without timeouts and not getting banned.

Blockchains

Supports blockchain explorers:

Installation

pip install -U aioetherscan

Usage

Register Etherscan account and create free API key.

import asyncio

from aioetherscan import Client
from asyncio_throttle import Throttler


async def main():
    c = Client('apikey')
    throttler = Throttler(rate_limit=5, period=1.0)
    try:
        print(await c.stats.eth_price())
        print(await c.block.block_reward(123456))

        async for t in c.utils.token_transfers_generator(
            address='0x9f8f72aa9304c8b593d555f12ef6589cc3a579a2',
            throttler=throttler
        ):
            print(t)
    finally:
        await c.close()


if __name__ == '__main__':
    asyncio.run(main())

About

Etherscan API async Python wrapper


Languages

Language:Python 100.0%