Team Ai
Datasetpublic

codekingpro/portable-devtools

sourceHugging Faceupdated 5mo agoView on Hugging Face
1likes14kdownloads
security.py20 linesDownload Raw Back to common
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 
codekingpro/portable-devtools · Team Ai