scripts/get_traffic.py
def check_data_redundancy(self, file_path='', dict_to_check={}):
        """
        Checks the given csv file against the json data scraped for the given
        dict. It will remove all data retrieved that has already been recorded
        so we don't write redundant data to file. Returns count of rows from
        file.
        """
        count = 0
        exists = os.path.isfile(file_path)
        previous_dates = {}
        if exists:
            with open(file_path, 'r') as input:
                input.readline()#skip header line
                for row in csv.reader(input):
                    timestamp = calendar.timegm(time.strptime(row[0],
                        '%Y-%m-%d'))
                    if timestamp in dict_to_check:#our date is already recorded
                        del dict_to_check[timestamp]
                    #calc current id max
                    count += 1
            input.close()
        return count
def check_data_redundancy(self, file_path='', dict_to_check={}):
        count = 0
        exists = os.path.isfile(file_path)
        previous_dates = {}
        if exists:
            with open(file_path, 'r') as input:
                input.readline()#skip header line
                for row in csv.reader(input):
                    timestamp = calendar.timegm(time.strptime(row[0],
                        '%Y-%m-%d'))
                    if timestamp in dict_to_check:#our date is already recorded
                        del dict_to_check[timestamp]
                    #calc current id max
                    count += 1
            input.close()
        return count
def check_data_redundancy ( self , file_path = '' , dict_to_check = { } ) : count = 0 exists = os . path . isfile ( file_path ) previous_dates = { } if exists : with open ( file_path , 'r' ) as input : input . readline ( ) #skip header line for row in csv . reader ( input ) : timestamp = calendar . timegm ( time . strptime ( row [ 0 ] , '%Y-%m-%d' ) ) if timestamp in dict_to_check : #our date is already recorded del dict_to_check [ timestamp ] #calc current id max count += 1 input . close ( ) return count
Checks the given csv file against the json data scraped for the given
        dict. It will remove all data retrieved that has already been recorded
        so we don't write redundant data to file. Returns count of rows from
        file.
Checks the given csv file against the json data scraped for the given dict . It will remove all data retrieved that has already been recorded so we don t write redundant data to file . Returns count of rows from file .