def get_random_string(length=32, choices=None): """ This function creates a random string with a given length. The strings consist of upper and lower case letters and numbers. @param length: the length of the randomized string, defaults to 32 @return: a random string containing lower and upper case letters and digits """ # Use all letters and numbers in the identifier if not choices: choices = string.ascii_letters + string.digits return django_get_random_string(length=length, allowed_chars=choices)
def get_random_string(length=32, choices=None): """ This function creates a random string with a given length. The strings consist of upper and lower case letters and numbers. @param length: the length of the randomized string, defaults to 32 @return: a random string containing lower and upper case letters and digits """ # Use all letters and numbers in the identifier if not choices: choices = string.ascii_letters + string.digits return django_get_random_string(length=length, allowed_chars=choices)
def get_random_string(length=12, allowed_chars='abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789' ): return django_get_random_string(length, allowed_chars)
def get_random_secret_key(): chars = 'abcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*(-_=+)' return django_get_random_string(50, chars)