You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

16 lines
336 B

import string
import random
import hashlib
def md5(s):
return hashlib.md5(s.encode()).hexdigest()
def find_by_id(iterable, _id):
for i in iterable:
if i['id'] == _id:
return i
return None
def generate_id(length=32):
return ''.join(random.choices(string.ascii_lowercase + string.digits, k=length))