Skip to content

Commit 7030596

Browse files
committed
convert to pyproject.toml
1 parent 16bb505 commit 7030596

File tree

88 files changed

+6796
-6466
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

88 files changed

+6796
-6466
lines changed

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,7 @@ docs
1515

1616
# eggs
1717
*egg*
18+
19+
.black
20+
.flake8
21+
.errors

Makefile

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,16 @@
11
install:
22
pip install -e .
33

4+
uninstall:
5+
pip uninstall -y rstms-etherscan-python
6+
47
.PHONY: test
5-
test:
8+
unitest:
69
bash ./run_tests.sh $(API_KEY)
710

811
clean:
912
find . -type d -name __pycache__ -exec rm -rf "{}" +
1013
rm -rf build *.egg-info
1114
rm -f .black .flake8 .errors .coverage
1215

13-
fmt:
14-
black -l 135 etherscan
15-
flake8 --max-line-len 135 etherscan
16+
include $(wildcard make/*.mk)

VERSION

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
2.1.0

etherscan/__init__.py

Lines changed: 17 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,18 @@
1-
from .etherscan import Etherscan
2-
from .modules.accounts import Accounts as accounts
3-
from .modules.blocks import Blocks as blocks
4-
from .modules.contracts import Contracts as contracts
5-
from .modules.gastracker import GasTracker as gastracker
6-
from .modules.pro import Pro as pro
7-
from .modules.proxy import Proxy as proxy
8-
from .modules.stats import Stats as stats
9-
from .modules.tokens import Tokens as tokens
10-
from .modules.transactions import Transactions as transactions
1+
"""
2+
etherscan-python
113
12-
__all__ = [
13-
"Etherscan",
14-
"accounts",
15-
"blocks",
16-
"contracts",
17-
"gastracker",
18-
"pro",
19-
"proxy",
20-
"stats",
21-
"tokens",
22-
"transactions",
23-
]
4+
A minimal, yet complete, python API for etherscan.io.
5+
6+
forked from: https://github.com/pcko1/etherscan-python
7+
8+
"""
9+
10+
from .modules.accounts import Accounts as accounts # noqa: F401
11+
from .modules.blocks import Blocks as blocks # noqa: F401
12+
from .modules.contracts import Contracts as contracts # noqa: F401
13+
from .modules.gastracker import GasTracker as gastracker # noqa: F401
14+
from .modules.pro import Pro as pro # noqa: F401
15+
from .modules.proxy import Proxy as proxy # noqa: F401
16+
from .modules.stats import Stats as stats # noqa: F401
17+
from .modules.tokens import Tokens as tokens # noqa: F401
18+
from .modules.transactions import Transactions as transactions # noqa: F401

etherscan/etherscan.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,10 @@ def __load_config(config_path: str) -> dict:
2424
def __run(func, api_key: str, net: str):
2525
def wrapper(*args, **kwargs):
2626
url = (
27-
f"{fields.PREFIX.format(net.lower()).replace('-main','')}" f"{func(*args, **kwargs)}" f"{fields.API_KEY}" f"{api_key}"
27+
f"{fields.PREFIX.format(net.lower()).replace('-main','')}"
28+
f"{func(*args, **kwargs)}"
29+
f"{fields.API_KEY}"
30+
f"{api_key}"
2831
)
2932
r = requests.get(url, headers={"User-Agent": ""})
3033
return parser.parse(r)

etherscan/modules/accounts.py

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,14 @@ def get_internal_txs_by_address_paginated(
151151
@staticmethod
152152
def get_internal_txs_by_txhash(txhash: str) -> str:
153153
# NOTE: Returns the last 10k events
154-
url = f"{fields.MODULE}" f"{modules.ACCOUNT}" f"{fields.ACTION}" f"{actions.TXLIST_INTERNAL}" f"{fields.TXHASH}" f"{txhash}"
154+
url = (
155+
f"{fields.MODULE}"
156+
f"{modules.ACCOUNT}"
157+
f"{fields.ACTION}"
158+
f"{actions.TXLIST_INTERNAL}"
159+
f"{fields.TXHASH}"
160+
f"{txhash}"
161+
)
155162
return url
156163

157164
@staticmethod
@@ -206,7 +213,9 @@ def get_erc20_token_transfer_events_by_address(
206213
return url
207214

208215
@staticmethod
209-
def get_erc20_token_transfer_events_by_contract_address_paginated(contract_address: str, page: int, offset: int, sort: str) -> str:
216+
def get_erc20_token_transfer_events_by_contract_address_paginated(
217+
contract_address: str, page: int, offset: int, sort: str
218+
) -> str:
210219
url = (
211220
f"{fields.MODULE}"
212221
f"{modules.ACCOUNT}"

etherscan/modules/blocks.py

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,25 @@
66
class Blocks:
77
@staticmethod
88
def get_block_reward_by_block_number(block_no: str) -> str:
9-
url = f"{fields.MODULE}" f"{modules.BLOCK}" f"{fields.ACTION}" f"{actions.GET_BLOCK_REWARD}" f"{fields.BLOCKNO}" f"{block_no}"
9+
url = (
10+
f"{fields.MODULE}"
11+
f"{modules.BLOCK}"
12+
f"{fields.ACTION}"
13+
f"{actions.GET_BLOCK_REWARD}"
14+
f"{fields.BLOCKNO}"
15+
f"{block_no}"
16+
)
1017
return url
1118

1219
@staticmethod
1320
def get_est_block_countdown_time_by_block_number(block_no: str) -> str:
1421
url = (
15-
f"{fields.MODULE}" f"{modules.BLOCK}" f"{fields.ACTION}" f"{actions.GET_BLOCK_COUNTDOWN}" f"{fields.BLOCKNO}" f"{block_no}"
22+
f"{fields.MODULE}"
23+
f"{modules.BLOCK}"
24+
f"{fields.ACTION}"
25+
f"{actions.GET_BLOCK_COUNTDOWN}"
26+
f"{fields.BLOCKNO}"
27+
f"{block_no}"
1628
)
1729
return url
1830

etherscan/modules/contracts.py

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,26 @@
99
class Contracts:
1010
@staticmethod
1111
def get_contract_abi(address: str) -> str:
12-
url = f"{fields.MODULE}" f"{modules.CONTRACT}" f"{fields.ACTION}" f"{actions.GET_ABI}" f"{fields.ADDRESS}" f"{address}"
12+
url = (
13+
f"{fields.MODULE}"
14+
f"{modules.CONTRACT}"
15+
f"{fields.ACTION}"
16+
f"{actions.GET_ABI}"
17+
f"{fields.ADDRESS}"
18+
f"{address}"
19+
)
1320
return url
1421

1522
@staticmethod
1623
def get_contract_source_code(address: str) -> str:
17-
url = f"{fields.MODULE}" f"{modules.CONTRACT}" f"{fields.ACTION}" f"{actions.GET_SOURCE_CODE}" f"{fields.ADDRESS}" f"{address}"
24+
url = (
25+
f"{fields.MODULE}"
26+
f"{modules.CONTRACT}"
27+
f"{fields.ACTION}"
28+
f"{actions.GET_SOURCE_CODE}"
29+
f"{fields.ADDRESS}"
30+
f"{address}"
31+
)
1832
return url
1933

2034
@staticmethod

etherscan/modules/transactions.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,14 @@
66
class Transactions:
77
@staticmethod
88
def get_contract_execution_status(txhash: str) -> str:
9-
url = f"{fields.MODULE}" f"{modules.TRANSACTION}" f"{fields.ACTION}" f"{actions.GET_STATUS}" f"{fields.TXHASH}" f"{txhash}"
9+
url = (
10+
f"{fields.MODULE}"
11+
f"{modules.TRANSACTION}"
12+
f"{fields.ACTION}"
13+
f"{actions.GET_STATUS}"
14+
f"{fields.TXHASH}"
15+
f"{txhash}"
16+
)
1017
return url
1118

1219
@staticmethod

etherscan/version.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
__version__ = "2.1.0"

0 commit comments

Comments
 (0)