def get_next_user(self): next = self.pop_from_todo() try: next_user = User(self.api, next) next_user.populate() except KeyboardInterrupt, k: # Re-queue the user if interrupted self.add_to_todo(next) raise k
def fetch_users(userlist, filename): mix = MixcloudAPI() testfile = open(filename,"w") for each in userlist: print each, "(current user)" current_user = User(mix, each) print each, "(populating...)" current_user.populate() print each, "(populated, dumping to file)" json.dump(current_user.get_data(),testfile, indent=2) print each, "(OK)"