Skip to content

load_IMEI_database_into_Redis only loads the last entry from TAC CSV #247

@svinson1121

Description

@svinson1121

In database.py, inside the function load_IMEI_database_into_Redis, the current code appends the TAC CSV entries to tacList['tacList'] outside of the loop, causing only the last line in the CSV to be stored in Redis.

Proposed Fix:
Move the append statement inside the loop, so each line is added:

for line in csvfile:
    # Remove unsafe characters from the CSV file
    line = line.replace('"', '')
    line = line.replace("'", '')
    line = line.replace("\\", '')
    line = line.rstrip()
    result = line.split(',')
    tacPrefix = result[0]
    name = result[1].lstrip()
    model = result[2].lstrip()
    
    tacList['tacList'].append({str(tacPrefix): {'name': name, 'model': model}})
    count += 1  ```

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions