pauldechorgnat commited on
Commit
20103bc
·
1 Parent(s): 38ec31b

Adding debug statements

Browse files
Files changed (1) hide show
  1. app.py +9 -1
app.py CHANGED
@@ -1,4 +1,5 @@
1
  import streamlit as st
 
2
 
3
  st.header("Exemple de titrage automatique")
4
 
@@ -13,17 +14,22 @@ def check_url_input(url):
13
 
14
  # checking the URL
15
  if len(url_splits) != 5:
 
16
  return False
17
  if url_splits[0] != "https:":
 
18
  return False
19
  if url_splits[2] not in ["www.courdecassation.fr", "courdecassation.fr"]:
 
20
  return False
21
- if url_splits[3] != "deicsion":
 
22
  return False
23
 
24
  # checking the judilibre id
25
  try:
26
  int(url_splits[4], base=16)
 
27
  except ValueError:
28
  return False
29
 
@@ -34,3 +40,5 @@ if check_url_input(url_input):
34
  judilibre_id = url_input.split("/")[-1]
35
 
36
  st.subheader(f"La décision choisie est {url_input}")
 
 
 
1
  import streamlit as st
2
+ import logging
3
 
4
  st.header("Exemple de titrage automatique")
5
 
 
14
 
15
  # checking the URL
16
  if len(url_splits) != 5:
17
+ logging.debug("URL is not long enough")
18
  return False
19
  if url_splits[0] != "https:":
20
+ logging.debug("URL does not contain 'https:'")
21
  return False
22
  if url_splits[2] not in ["www.courdecassation.fr", "courdecassation.fr"]:
23
+ logging.debug("URL does not refer to 'courdecassation.fr'")
24
  return False
25
+ if url_splits[3] != "decision":
26
+ logging.debug("URL does not contain 'decision'")
27
  return False
28
 
29
  # checking the judilibre id
30
  try:
31
  int(url_splits[4], base=16)
32
+ logging.debug("Decision ID is not the right format")
33
  except ValueError:
34
  return False
35
 
 
40
  judilibre_id = url_input.split("/")[-1]
41
 
42
  st.subheader(f"La décision choisie est {url_input}")
43
+ else:
44
+ st.warning("L'URL n'est pas conforme...")