datacipen commited on
Commit
85315fc
·
verified ·
1 Parent(s): 5484343

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -2
app.py CHANGED
@@ -6,6 +6,7 @@ from offres_emploi import Api
6
  from offres_emploi.utils import dt_to_str_iso
7
  from dash import Dash, html, dcc, callback, Output, Input, dash_table, State, _dash_renderer, clientside_callback
8
  import dash_bootstrap_components as dbc
 
9
  import plotly.express as px
10
  import plotly.graph_objects as go
11
  import dash_mantine_components as dmc
@@ -555,7 +556,7 @@ def textbox(text, box="AI", name="Philippe"):
555
 
556
  # Authentication
557
  #openai.api_key = os.getenv("OPENAI_KEY")
558
-
559
 
560
  # Define Layout
561
  conversation = html.Div(
@@ -604,7 +605,10 @@ class CustomDash(Dash):
604
 
605
  #app = Dash(__name__, external_scripts=external_scripts, external_stylesheets=dmc.styles.ALL, on_error=custom_error_handler)
606
  app = CustomDash(__name__, server=server, external_scripts=external_scripts, external_stylesheets=dmc.styles.ALL, on_error=custom_error_handler)
607
-
 
 
 
608
  def connexion_France_Travail():
609
  client = Api(client_id=os.getenv('POLE_EMPLOI_CLIENT_ID'),
610
  client_secret=os.getenv('POLE_EMPLOI_CLIENT_SECRET'))
 
6
  from offres_emploi.utils import dt_to_str_iso
7
  from dash import Dash, html, dcc, callback, Output, Input, dash_table, State, _dash_renderer, clientside_callback
8
  import dash_bootstrap_components as dbc
9
+ import dash_auth
10
  import plotly.express as px
11
  import plotly.graph_objects as go
12
  import dash_mantine_components as dmc
 
556
 
557
  # Authentication
558
  #openai.api_key = os.getenv("OPENAI_KEY")
559
+ VALID_USERNAME_PASSWORD_PAIRS = os.environ['VALID_USERNAME_PASSWORD_PAIRS']
560
 
561
  # Define Layout
562
  conversation = html.Div(
 
605
 
606
  #app = Dash(__name__, external_scripts=external_scripts, external_stylesheets=dmc.styles.ALL, on_error=custom_error_handler)
607
  app = CustomDash(__name__, server=server, external_scripts=external_scripts, external_stylesheets=dmc.styles.ALL, on_error=custom_error_handler)
608
+ auth = dash_auth.BasicAuth(
609
+ app,
610
+ VALID_USERNAME_PASSWORD_PAIRS
611
+ )
612
  def connexion_France_Travail():
613
  client = Api(client_id=os.getenv('POLE_EMPLOI_CLIENT_ID'),
614
  client_secret=os.getenv('POLE_EMPLOI_CLIENT_SECRET'))