File tree Expand file tree Collapse file tree 1 file changed +9
-24
lines changed Expand file tree Collapse file tree 1 file changed +9
-24
lines changed Original file line number Diff line number Diff line change 44class Tokens (Client ):
55 def __init__ (self , tokenname = 'TheDAO' , api_key = 'YourApiKeyToken' ):
66 Client .__init__ (self , address = '' , api_key = api_key )
7- self .tokenname = '&tokenname=' + tokenname
8-
9- def make_url (self , call_type = '' ):
10- if call_type == 'tokensupply' :
11- self .url = self .URL_BASES ['prefix' ] \
12- + self .module \
13- + self .action \
14- + self .tokenname \
15- + self .key
16- elif call_type == 'tokenbalance' :
17- self .url = self .URL_BASES ['prefix' ] \
18- + self .module \
19- + self .action \
20- + self .tokenname \
21- + self .address \
22- + self .key
7+ self .url_dict [self .TOKEN_NAME ] = tokenname
238
249 def get_total_supply (self ):
25- self .action = self .URL_BASES [ 'action' ] + 'tokensupply'
26- self .module = self .URL_BASES [ 'module' ] + 'stats'
27- self .make_url ( call_type = 'tokensupply' )
10+ self .url_dict [ self .ACTION ] = 'tokensupply'
11+ self .url_dict [ self .MODULE ] = 'stats'
12+ self .build_url ( )
2813 req = self .connect ()
2914 return req ['result' ]
3015
3116 def get_token_balance (self , address ):
32- self .address = self .URL_BASES [ 'address' ] + address
33- self .module = self .URL_BASES [ 'module' ] + 'account'
34- self .action = self .URL_BASES [ 'action' ] + 'tokenbalance'
35- self .make_url ( call_type = 'tokenbalance' )
17+ self .url_dict [ self .ADDRESS ] = address
18+ self .url_dict [ self .MODULE ] = 'account'
19+ self .url_dict [ self .ACTION ] = 'tokenbalance'
20+ self .build_url ( )
3621 req = self .connect ()
37- return req ['result' ]
22+ return req ['result' ]
You can’t perform that action at this time.
0 commit comments