Remove problematic characters.

fix #898
This commit is contained in:
Antoine Nguyen
2016-08-30 08:30:30 +02:00
parent 98c4c84015
commit 9d5524831a
+2 -1
View File
@@ -16,7 +16,8 @@ def random_key(l=16):
:param integer l: the key's length
:return: a string
"""
population = string.digits + string.letters + string.punctuation
punctuation = """!#$%&'()*+,-./:;<=>?@[]^_`{|}~"""
population = string.digits + string.letters + punctuation
while True:
key = "".join(random.sample(population * l, l))
if len(key) == l: