An unofficial wrapper for the Etherscan.io API
Project description
pyetherscan
An unofficial wrapper for the Etherscan API.
Installation
We recommend you install this library in a new virtual environment.
To install, create a new etherscan account and make note of your API key. Then install the library by running:
pip install pyetherscan
When using the library, you must set the ETHERSCAN_API_KEY environment variable.
Usage
There are two main ways to use the library. The first is via the Client object to interact directly with the Etherscan API.
In [1]: client = Client()
In [2]: address = '0xde0b295669a9fd93d5f28d9ec85e40f4cb697bae'
In [3]: address_balance = client.get_single_balance(address)
In [4]: address_balance.response_status_code
Out[4]: 200
In [5]: address_balance.message
Out[5]: 'OK'
In [6]: address_balance.balance
Out[6]: 748997604382925139479303
The second is to use pyetherscan objects which fully abstract the API. These objects can be found in the pyetherscan.ethereum module and include:
Transaction
Address
Block
Token
For example:
In [1]: address = '0xde0b295669a9fd93d5f28d9ec85e40f4cb697bae'
In [2]: ethereum_address = Address(address)
In [3]: ethereum_address.balance
Out[3]: 748997604382925139479303.0
In [4]: for txn in ethereum_address.transactions:
...: print(txn.value)
Contributing
Fork this repository, create a branch and issue a PR.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file pyetherscan-0.0.0.tar.gz
.
File metadata
- Download URL: pyetherscan-0.0.0.tar.gz
- Upload date:
- Size: 13.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a1c2d47a2fd639346d673ef5ba7d288c5154c0f3def5033d3e1b4dd2b7080e19 |
|
MD5 | a603b4e838b337af03e720236fbba52a |
|
BLAKE2b-256 | ec7cc62027c40562286eaad6618085e58aa604d90d17b173c4c0ce29b9460ded |
File details
Details for the file pyetherscan-0.0.0-py3-none-any.whl
.
File metadata
- Download URL: pyetherscan-0.0.0-py3-none-any.whl
- Upload date:
- Size: 16.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ba693c16bd1ca0db56ab81768789c6d630c477d3762e5758d200d323313004b0 |
|
MD5 | 6ba851e4ac1b8cd2b42fa2d9e219c46a |
|
BLAKE2b-256 | b78d97aeffd092eaf0a7f336431dc6d691350a0a73c40e9758e95c0712ff056a |