codekingpro/portable-devtools
114k
1import os2import string3import random4 5UNICODE_ASCII_CHARACTER_SET = string.ascii_letters + string.digits6 7 8def generate_token(length=30, chars=UNICODE_ASCII_CHARACTER_SET):9 rand = random.SystemRandom()10 return ''.join(rand.choice(chars) for _ in range(length))11 12 13def is_secure_transport(uri):14 """Check if the uri is over ssl."""15 if os.getenv('AUTHLIB_INSECURE_TRANSPORT'):16 return True17 18 uri = uri.lower()19 return uri.startswith(('https://', 'http://localhost:'))20 