import os

import redis

r = redis.from_url(f"redis://:{os.environ.get('REDIS_PASSWORD','')}@{os.environ['REDIS_HOST']}:{os.environ['REDIS_PORT']}/0")
keys = list(r.scan_iter("stonks:dedupe:*"))
if keys:
    r.delete(*keys)
    print(f"Cleared {len(keys)} dedupe keys")
else:
    print("No dedupe keys")
