import secrets secrets.token_hex(nbytes=16) # this will produce something like # aa82d48e5bff564f3221d02194611c13