added traceback and try/exception

main
Lasse Server 3 years ago
parent 2ba1e94eb2
commit 5740e8b92b
  1. 26
      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()

Loading…
Cancel
Save