2020-05-22 12:05:33 +00:00
|
|
|
import random
|
|
|
|
import string
|
|
|
|
|
|
|
|
ALPHANUMERIC_CHARS = string.ascii_lowercase + string.ascii_uppercase + string.digits
|
2020-05-24 14:05:04 +00:00
|
|
|
MIN_STRING_LENGTH = 11
|
|
|
|
MAX_STRING_LENGTH = 27
|
2020-05-22 12:05:33 +00:00
|
|
|
|
2020-05-24 14:05:04 +00:00
|
|
|
random_string_length = random.randint(MIN_STRING_LENGTH,MAX_STRING_LENGTH)
|
|
|
|
|
|
|
|
|
|
|
|
def generate_random_string(chars=ALPHANUMERIC_CHARS,length=random_string_length):
|
2020-05-22 12:05:33 +00:00
|
|
|
return "".join(random.choice(chars) for _ in range(length))
|