def fetch_profile_db(username): profile = profiles.find_one({"username": username})["profile"] return profile def fetch_profile_mem(username): profile = mc.get("profile_" + str(username)) if profile is None: return username return profile # ----------------------------------- if __name__ == "__main__": namespace = namespaces.find_one({"blocks": 36000}) usernames = namespace["namespace"] for username in usernames: print fetch_profile_namecoind(username) # pool = Pool(100) # pool.map(fetch_profile_mem, usernames)
proxy = AuthServiceProxy('http://*****:*****@localhost:8080') # hack around absolute paths current_dir = os.path.abspath(os.path.dirname(__file__)) parent_dir = os.path.abspath(current_dir + "/../") sys.path.insert(0, parent_dir) from server.resolver import namespaces def get_profile(username): return proxy.get_profile(username) def get_namespace(): return proxy.get_namespace() # ----------------------------------- if __name__ == '__main__': namespace = namespaces.find_one({"blocks": 36000}) usernames = namespace['namespace'] #for username in usernames: # print get_profile(username) print get_namespace()
def get_namespace(): namespace = namespaces.find_one({"blocks": VALID_BLOCKS}) return namespace['profiles']