Home > OS >  import of a function fails
import of a function fails

Time:12-08

I've written this code for the homepage of my streamlit app:

import streamlit as st  
from streamlit_login_auth_ui.widgets import __login__

__login__obj = __login__(auth_token = st.secrets['courier_auth_token'], 
                    company_name = "The Suite",
                    width = 200, height = 250, 
                    logout_button_name = 'Logout',
                    hide_menu_bool = False, 
                    hide_footer_bool = True, 
                    lottie_url = 'https://assets2.lottiefiles.com/packages/lf20_jcikwtux.json'
                    )

LOGGED_IN = __login__obj.build_login_ui()

if LOGGED_IN != True:
    with open('style3.css') as f:
        st.markdown(f'<style>{f.read()}</style>', unsafe_allow_html=True)

if LOGGED_IN == True:
    st.sidebar.success('Select a page above')

    username = __login__obj.get_username()

    if username =='Liscivia':
        def show_download_Json():
            with open('_secret_auth_.json') as f:
                st.download_button('Download Json', f)

        show_download_Json()

I'd need to call the get_username() function to retrieve my user as an admin to be able to download a file. This is the repo that I used to create the login form: enter image description here

image 2

enter image description here

  • Related