Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
This repository was archived by the owner on Jul 2, 2024. It is now read-only.

Commitfdd3d73

Browse files
author
Kotsias, Panagiotis-Christos
committed
Changed auth to run
1 parent52a34ff commitfdd3d73

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

‎etherscan/client.py‎

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
importjson
2+
fromfunctoolsimportwraps
23

34
importrequests
45

@@ -14,7 +15,8 @@ def __load_config(config_path: str) -> dict:
1415
returnjson.load(f)
1516

1617
@staticmethod
17-
def__auth(func,api_key):
18+
def__run(func,api_key):
19+
# decorator to authorize and get urls
1820
defwrapper(*args,**kwargs):
1921
url= (
2022
f"{fields.PREFIX}"
@@ -27,11 +29,21 @@ def wrapper(*args, **kwargs):
2729

2830
returnwrapper
2931

32+
@staticmethod
33+
def__check_status(func):
34+
# decorator to assert message status
35+
defwrapper(*args,**kwargs):
36+
res,status,msg=func(*args,**kwargs)
37+
assertbool(status),msg
38+
return (res,msg)
39+
40+
returnwrapper
41+
3042
@classmethod
3143
deffrom_config(cls,config_path:str,api_key:str):
3244
config=cls.__load_config(config_path)
3345
forfunc,vinconfig.items():
3446
ifnotfunc.startswith("_"):# disabled if _
3547
attr=getattr(getattr(etherscan,v["module"]),func)
36-
setattr(cls,func,cls.__auth(attr,api_key))
48+
setattr(cls,func,cls.__check_status(cls.__run(attr,api_key)))
3749
returncls

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp