from dbsettings.functions import getValue

import random

def generate_token(len=getValue("smsotp.length", 6), chars=getValue("smsotp.chars", "0123456789")):
    return "".join(random.choices(chars, k=int(len)))