Remove exception from output.
Improve output and replace double ticks.
Fix tests and index out of range error.
git clone git@git.sr.ht:~busykoala/pwned_api
cd pwned_api
python3 -m venv .
source ./bin/activate
pip install -e .
To finish the setup move the textfile to projectroot/passwords.txt
.
The file should look like this (with newline instead of \n
):
7C4A8D09CA3762AF61E59520943DC26494F8941B:23547453\n
7C4A8D09CA3762AF61E59520943DC26494F8941B:23547453\n
Therefore each line contains a sha1 hash and the number of occurences. Also see https://haveibeenpwned.com/Passwords as a reference.
Execute python app/insert_to_db.py
to insert them into the DB.
# development mode
python app/__init__.py
# deployment mode (create service with command)
gunicorn app:init_app --bind 0.0.0.0:8081 --worker-class aiohttp.GunicornWebWorker
source ./bin/activate
pip install -e ".[test]"
python -m pytest --flake8
>> CREATE DATABASE passwords
>> CREATE TABLE passwords (hash TEXT PRIMARY KEY, occurences INTEGER)
>> INSERT INTO passwords(hash, occurences) VALUES('5BAA61E4C9B93F3F0682250B6CF8331B7EE68FD8', 42);
>> pwned_api=# CREATE INDEX cluster_hash ON passwords (hash);
CREATE INDEX
>> pwned_api=# CLUSTER passwords USING cluster_hash;
CLUSTER