get_abi_from_blockscout
Function
def get_abi_from_blockscout(address, attempts=18):
while attempts > 0:
try:
r = requests.get("https://api.scan.pulsechain.com/api/v2/smart-contracts/{}".format(address))
r.raise_for_status()
except RequestException:
attempts -= 1
if attempts > 0:
time.sleep(1)
continue
else:
raise RequestException
else:
resp = r.json()
if 'abi' in resp.keys():
return resp['abi']
else:
return []