Skip to content

ape364/aioetherscan

Repository files navigation

aioetherscan

PyPi License Coveralls Versions

Etherscan.io API async Python non-official wrapper.

Features

API modules

Supports all API modules:

Also provides extra module, which supports:

  • link helps to compose links to address/tx/etc
  • contract helps to fetch contract data
  • generators 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
import logging

from aiohttp_retry import ExponentialRetry
from asyncio_throttle import Throttler

from aioetherscan import Client

logging.basicConfig(format='%(asctime)s - %(message)s', level=logging.INFO)


async def main():
    throttler = Throttler(rate_limit=4, period=1.0)
    retry_options = ExponentialRetry(attempts=2)

    c = Client('YourApiKeyToken', throttler=throttler, retry_options=retry_options)

    try:
        print(await c.stats.eth_price())
        print(await c.block.block_reward(123456))

        address = '0x9f8f72aa9304c8b593d555f12ef6589cc3a579a2'
        async for t in c.extra.generators.token_transfers(
                address=address,
                start_block=19921833,
                end_block=19960851
        ):
            print(t)
            print(c.extra.link.get_tx_link(t['hash']))

        print(c.extra.link.get_address_link(address))
    finally:
        await c.close()


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

About

Etherscan API async Python wrapper

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 6

Languages

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy