запилил на коленке чекер форков крипты:
import requests
from multiprocessing import Pool
class Fork():
def __init__(self, filename):
f = open(filename, 'r')
with Pool(2) as p:
p.map(self.make_all, f)
def make_all(self, address):
fg = address.split(',')[1]
fg = fg.strip()
btc = self.btc_balance(fg)
bch = self.bch_balance(fg)
btx = self.btx_balance(fg)
superbtc = self.superbtc_balance(fg)
b2x = self.b2x_balance(fg)
print('| %s | %s | %s | %s | %s | %s |\n' % (fg, btc, bch, btx, superbtc, b2x))
def btc_balance(self, address):
while True:
r = requests.get('https://blockchain.info/q/addressbalance/%s' % address)
if r.text.isdigit():
balance = int(r.text) / 100000000
return 'BTC:%s' % str(balance)
def bch_balance(self, address):
r = requests.get('https://galvanize-cors-proxy.herokuapp.com/api.blockchair.com/bitcoin-cash/dashboards/address/%s' % address)
balance = int(r.json()['data'][0]['sum_value_unspent']) / 100000000
return 'BCH:%s' % str(balance)
def btx_balance(self, address):
r = requests.get('https://galvanize-cors-proxy.herokuapp.com/chainz.cryptoid.info/btx/api.dws?q=getbalance&a=%s' % address)
# balance = int(r.text) / 100000000
return 'BTX:%s' % r.text
def superbtc_balance(self, address):
r = requests.get('https://galvanize-cors-proxy.herokuapp.com/http://block.superbtc.org/insight-api/addr/%s/?noTxList=1' % address)
return 'SUPERBTC:%s' % r.json()['balance']
def b2x_balance(self, address):
r = requests.get('https://explorer.b2x-segwit.io/b2x-insight-api/addr/%s/?noTxList=1' % address)
return 'B2X%s' % r.json()['balance']
if __name__ == '__main__':
Fork('tratra_clear.txt')
print('| %s | %s | %s | %s | %s | %s |\n' % (fg, btc, bch, btx, superbtc, b2x))