Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit c59a258

Browse files
author
Kotsias, Panagiotis-Christos
committed
Added instructions
1 parent 16a9d7d commit c59a258

File tree

1 file changed

+31
-6
lines changed

1 file changed

+31
-6
lines changed

README.md

+31-6
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,17 @@
66

77
# etherscan-python
88

9-
Minimal python API for [etherscan.io](etherscan.io).
9+
A minimal python API for [etherscan.io](etherscan.io).
10+
11+
Most of the free webhooks from the [Accounts](https://etherscan.io/apis#accounts), [Contracts](https://etherscan.io/apis#contracts), [Transactions](https://etherscan.io/apis#transactions) and [Tokens](https://etherscan.io/apis#tokens) modules are supported.
12+
13+
Their example use-cases are summarized [here](https://api.etherscan.io/apis).
1014

1115
## Installation
1216

13-
Assuming [conda](https://docs.conda.io/en/latest/miniconda.html) is already installed in your system, first create the environment:
17+
Before proceeding, you should register an account on etherscan.io and generate a personal API key to use.
18+
19+
Assuming [conda](https://docs.conda.io/en/latest/miniconda.html) is already installed on your system, first create the environment:
1420

1521
``` bash
1622
conda env create -f env.yml
@@ -30,11 +36,30 @@ pip install .
3036

3137
## Run unittests
3238

33-
34-
3539
``` bash
36-
conda activate etherscan-python && bash run_tests.sh
37-
````
40+
conda activate etherscan-python && bash run_tests.sh
41+
````
42+
43+
## Usage
44+
45+
In `python` , create a client with your personal etherscan.io API key:
46+
47+
``` python
48+
from etherscan.client import Client
49+
50+
api_key = YOUR_API_KEY
51+
config_path = "etherscan/configs/stable.json"
52+
53+
client = Client.from_config(config_path, api_key)
54+
```
55+
56+
Then you can call all available methods, e.g.:
57+
58+
``` python
59+
client.get_eth_balance(address="0xddbd2b932c763ba5b1b7ae3b362eac3e8d40121a")
60+
61+
> ('40891631566070000000000', 'OK')
62+
```
3863

3964
___
4065
Powered by [Etherscan.io APIs](https://etherscan.io/apis).

0 commit comments

Comments
 (0)