def pool_data(self): if not self.data or time.time() - self.timestamp > TIMEOUT: self.data = {} d = ja.request("https://api-zcash.flypool.org/miner/{}/currentStats".format(self.wallet)) if d: self.data["stats"] = d.get("data") d = ja.request("https://api-zcash.flypool.org/miner/{}/workers".format(self.wallet)) if d: self.data["workers"] = d.get("data") self.timestamp = time.time() return self.data
def pool_data(self): if not self.data or time.time() - self.timestamp > TIMEOUT: self.data = None self.data = ja.request( "https://{}.coinblockers.com/api/worker_stats?{}".format( self.crypto, self.key)) self.timestamp = time.time() return self.data
def api_call(self, method): try: return ja.request( API.format(crypto=self.crypto, method=method, apikey=self.key, id=self.id)).get(method).get("data") except Exception as ex: print(ex) return None
def pool_data(self): try: if not self.data or time.time() - self.timestamp > TIMEOUT: self.data = ja.request( "https://api.nanopool.org/v1/{}/user/{}".format( self.crypto, self.wallet)).get('data') self.timestamp = time.time() except Exception as ex: self.data = {} return self.data
def pool_data(self): if not self.data or time.time() - self.timestamp > TIMEOUT: self.data = {} time.sleep(random.randrange(0, 4, 1)) d = ja.request("https://{}.suprnova.cc/index.php?page=api&action=getuserstatus&api_key={}".format(self.crypto, self.key)) if d: self.data['status'] = d.get('getuserstatus').get('data') else: self.data['status'] = None time.sleep(random.randrange(0, 4, 1)) d = ja.request("https://{}.suprnova.cc/index.php?page=api&action=getuserbalance&api_key={}".format(self.crypto, self.key)) if d: self.data['balance'] = d.get('getuserbalance').get('data') else: self.data['balance'] = None time.sleep(random.randrange(0, 4, 1)) d = ja.request("https://{}.suprnova.cc/index.php?page=api&action=getuserworkers&api_key={}".format(self.crypto, self.key)) if d: self.data['workers'] = d.get('getuserworkers').get('data') else: self.data['workers'] = None self.timestamp = time.time() return self.data
def __get_active_miners(self): miners = [] rigs = self.conf['rigs'] for r in rigs: ip = rigs[r]['url'].replace("http://", "").split(":")[0] for w in ja.request(rigs[r]['url']): miners.append({ 'worker': w.get('worker'), 'host': ip, 'apiport': w.get('apiport'), 'crypto': w.get('crypto'), 'pool': w.get('pool'), 'miner': w.get('miner'), 'rig': r }) return miners
def miner_data(self): if not self.data or time.time() - self.timestamp > self.TIMEOUT: self.raw_data = ja.request(self.api) self.data = self.process_data(self.raw_data) self.timestamp = time.time() return self.data
def price(self, currency): url = "https://min-api.cryptocompare.com/data/price?fsym={}&tsyms={}".format(self.crypto.upper(), currency.upper()) return ja.request(url)
def network(self): net = self.get_network_api() data = ja.request(net["url"]).get(net["field"]) return {'diff': data.get(net.get('diff')), 'nethash': data.get(net.get('nethash'))}
def balance(self): return ja.request(self.get_balance_api()).get("balance") or 0