def setup_basic_auth(password=None, username='admin', uid='admin'):
    'Create the htacces file and the tokens.'
    root_cdk = '/root/cdk'
    if (not os.path.isdir(root_cdk)):
        os.makedirs(root_cdk)
    htaccess = os.path.join(root_cdk, 'basic_auth.csv')
    if (not password):
        password = token_generator()
    with open(htaccess, 'w') as stream:
        stream.write('{0},{1},{2}'.format(password, username, uid))
Create the htacces file and the tokens.
def setup_basic_auth(password=None, username='admin', uid='admin'):
    
    root_cdk = '/root/cdk'
    if (not os.path.isdir(root_cdk)):
        os.makedirs(root_cdk)
    htaccess = os.path.join(root_cdk, 'basic_auth.csv')
    if (not password):
        password = token_generator()
    with open(htaccess, 'w') as stream:
        stream.write('{0},{1},{2}'.format(password, username, uid))