Esempio n. 1
0
def get_non_retrieved(info_label):
    """
    #@Argument:
    """
    paths = file_loader.loadList(_output_path+"index.txt")
    current_user_index = pu.get_last_status(paths, log_path+"status.txt")
    i = 0
    non_retrieved_list = []
    for path in paths:
        label_found = False
        aux = 0
        for line in open(path.lstrip("/").rstrip("\n")):
        #First line right after the label, therefore there is data (at least one!)
            if label_found == True:
                aux += 1
                break
            if info_label in line:
                label_found = True
        if aux == 0:
            non_retrieved_list.append(path.rstrip("\n"))
        if i == current_user_index:
            break
        i = i + 1
    print i, len(non_retrieved_list)
    file_loader.listToTXT(non_retrieved_list, _output_path+"non_retrieved.txt")
Esempio n. 2
0
def store_listed_info(query, ids_list, screen_name, path):
    """
    #@Arguments:
    #ids_list = a list of ids or an empty list
    #screen_name = a string with the user screen name 
    #user_id = an integer with the user id
    #path = path for the file which contains user information and will hold all the followers
    #Return: None. Method saves information or stops program execution
    """
    if ids_list is not []:
        file_loader.listToTXT(ids_list,path,'a+', '', '#'+query.capitalize()+"\n")
    else:
        print 'Unexpected error'
        log.warning("Unexpected error! Couldn't retrieve followers of "+screen_name)
        sys.exit()
    print len(ids_list), query.capitalize()+' for ', screen_name
    log.note("Information successfully retrieved: "+screen_name)