Skip to content

Commit

Permalink
attempt to fix 6225
Browse files Browse the repository at this point in the history
Signed-off-by: Churikova Tetiana <churikova.tm@gmail.com>
  • Loading branch information
churik committed Feb 24, 2020
1 parent 90bae33 commit 7485093
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions test/appium/support/api/network_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,17 @@ def __init__(self):
'User-Agent':"Mozilla\/5.0 (Macintosh; Intel Mac OS X 10_14_6) AppleWebKit\
/537.36 (KHTML, like Gecko) Chrome\/77.0.3865.90 Safari\/537.36", }
self.chat_bot_url = 'http://offsite.chat:8099'
self.api_key = environ.get('ETHERSCAN_API_KEY')

def get_transactions(self, address: str) -> List[dict]:
method = self.network_url + 'module=account&action=txlist&address=0x%s&sort=desc&apikey=%s' % (address, environ.get('ETHERSCAN_API_KEY'))
method = self.network_url + 'module=account&action=txlist&address=0x%s&sort=desc&apikey=%s' % (address, self.api_key)
try:
return requests.request('GET', url=method, headers=self.headers).json()['result']
except TypeError:
print('Check response from etherscan API. Returned values don\'t match expected')

def get_token_transactions(self, address: str) -> List[dict]:
method = self.network_url + 'module=account&action=tokentx&address=0x%s&sort=desc&apikey=%s' % (address, environ.get('ETHERSCAN_API_KEY'))
method = self.network_url + 'module=account&action=tokentx&address=0x%s&sort=desc&apikey=%s' % (address, self.api_key)
try:
return requests.request('GET', url=method, headers=self.headers).json()['result']
except TypeError:
Expand All @@ -40,7 +41,7 @@ def is_transaction_successful(self, transaction_hash: str) -> int:
return not int(requests.request('GET', url=method, headers=self.headers).json()['result']['isError'])

def get_balance(self, address):
method = self.network_url + 'module=account&action=balance&address=0x%s&tag=latest' % address
method = self.network_url + 'module=account&action=balance&address=0x%s&tag=latest&apikey=%s' % (address , self.api_key)
for i in range(5):
try:
return int(requests.request('GET', method, headers=self.headers).json()["result"])
Expand Down

0 comments on commit 7485093

Please sign in to comment.