From 5740e8b92b0baae986478e97135181fa48f729cd Mon Sep 17 00:00:00 2001 From: Lasse Server Date: Mon, 10 Jul 2023 08:05:36 +0200 Subject: [PATCH] added traceback and try/exception --- app.py | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/app.py b/app.py index bd71e31..a394db3 100644 --- a/app.py +++ b/app.py @@ -4,6 +4,7 @@ import yaml from yaml.loader import SafeLoader import main import create_credentials +import traceback with open('credentials.yaml') as file: config = yaml.load(file, Loader=SafeLoader) @@ -32,11 +33,11 @@ def add_user(): st.write('Användare finns redan.') -def main(): - name, authentication_status, username = authenticator.login('Logga in', 'main') - if authentication_status: - +name, authentication_status, username = authenticator.login('Logga in', 'main') + +if authentication_status: + try: # Say hello st.markdown(f':blue[**Hej {name}!**]') @@ -44,7 +45,7 @@ def main(): add_user() # Ask for input - help_text = '[Du kan hitta en profils Facebook-ID här](https://lookup-id.com/)' + help_text = '[Du kan hitta en profils Facebook-ID här](https://findidfb.com/)' user_input = str(st.text_input('Skriv in telefonnummer eller Facebook-ID', help=help_text, placeholder='Skriv här...')).strip() if user_input != '': @@ -70,16 +71,17 @@ def main(): with st.expander('Mer information'): st.dataframe(r['df'], use_container_width=True) else: - st.text('Not found.') + st.text('Hittade inga uppgifter.') authenticator.logout('Logout', 'main') + except Exception as e: + traceback.print_exc() + st.write('Något gick fel :(') - elif authentication_status is False: - st.error('Fel användarnamn/lösenord') - - elif authentication_status is None: - st.warning('Skriv in användarnamn och lösenord') +elif authentication_status is False: + st.error('Fel användarnamn/lösenord') +elif authentication_status is None: + st.warning('Skriv in användarnamn och lösenord') -main()