def get_count_between_time(begin_time, end_time):
    f = open(config.filepath, 'r')
    lines = f.readlines()
    f.close()
    count = 0
    log_date = None
    date_now = begin_time
    for line in lines:
        if line == '\n' or len(line) == 0:
            continue
        
        log_date = string_logdate_to_datetime(common.get_date_from_line(line))
        status =common.get_status_from_line(line)
        
        if begin_time <= log_date and log_date <= end_time:
            
            if date_now == log_date and status == '200':
                count = count + 1
                
            else:
                url_date = datetime_format_to_urldate(log_date)
                common.send_data_print(url_date, count)
#                common.send_data(url_date, count)                
                count = 1
                date_now = log_date
                
        elif log_date > end_time:
                url_date = datetime_format_to_urldate(date_now)
                common.send_data_print(url_date, count)
#                common.send_data(url_date, count)
                break 
    if log_date <= end_time:
        url_date = datetime_format_to_urldate(log_date)
        common.send_data_print(url_date, count)
def get_count_time(time_desc):
    f = open(config.filepath, 'r')
    lines = f.readlines()
    f.close()
    flag = 0
    count = 0
    
    for line in lines:
        
        log_date = string_logdate_to_datetime(common.get_date_from_line(line))
        status = common.get_status_from_line(line)
        
        if log_date == time_desc and status == '200':
            count = count + 1
            flag = 1
        
        if flag == 1 and log_date != time_desc:
            break
           
    url_date = time.strftime(config.url_date_format, time_desc) 
    common.send_data_print(url_date,count)
    minuteNow = get_now_urldate_string();

    log_date = None

    while True:
        lines = get_lines_from_file()
        
        while len(lines) == 0:
            time.sleep(3)   # 睡眠时间不确定,或者可以不睡眠
            lines = get_lines_from_file()
            
        for line in lines: 
            if line == '\n' or len(line) == 0:
                continue   
            
            log_date_tmp = common.get_date_from_line(line)
            log_date = string_logdate_to_urldate(log_date_tmp)
            
            if flag == 0:
                if minuteNow == log_date:
                    flag = 1
                    count = count + 1
                continue
                
            status = common.get_status_from_line(line)
                        
            if minuteNow == log_date and status == '200':
                count = count + 1
                
            if cmp(minuteNow,log_date) != 0:
#                 common.send_data(log_date, count)