def get_expiring_names(regrex, expires_in): expiring_names = [] reply = namecoind.name_filter(regrex) counter_total = 0 counter_expiring = 0 for i in reply: counter_total += 1 try: if i['expires_in'] < expires_in: expiring_names.append(i) print i['name'] print i['expires_in'] counter_expiring += 1 #print i['value'] #print '-' * 5 except: print i print '-' * 5 print "Total names: " + str(counter_total) print "Total expiring in " + str(expires_in) + " blocks: " + str(counter_expiring) return expiring_names
def get_overlap(): reply = namecoind.name_filter('id/') counter = 0 id_namespace = [] for i in reply: if 'expired' in i: pass else: counter += 1 id_namespace.append(i['name'].lstrip('id/')) reply = namecoind.name_filter('u/') counter = 0 u_namespace = [] for i in reply: if 'expired' in i: pass else: counter += 1 u_namespace.append(i['name'].lstrip('u/')) from collections import Counter a_multiset = Counter(id_namespace) b_multiset = Counter(u_namespace) overlap = list((a_multiset & b_multiset).elements()) for i in overlap: print i print len(overlap)
def get_recent_names(regrex, updated_in): expiring_names = [] reply = namecoind.name_filter(regrex, updated_in) counter = 0 for i in reply: expiring_names.append(i) print i['name'] print i['expires_in'] counter += 1 print '-' * 5 print "Total updated in " + str(updated_in) + " blocks: " + str(counter) return expiring_names
def get_expired_names(regrex): expired_names = [] reply = namecoind.name_filter(regrex, check_blocks=0) counter_total = 0 counter_expired = 0 for i in reply: counter_total += 1 if 'expired' in i and i['expired'] == 1: print i['name'] counter_expired += 1 expired_names.append(i) print '-' * 5 print "Total names: " + str(counter_total) print "Total expired: " + str(counter_expired) return expired_names