Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -35,13 +35,11 @@ class CalendarWrappedAPI:
|
|
35 |
'redirect_url': connection_request.redirectUrl
|
36 |
}
|
37 |
|
38 |
-
# Wait for random time between 60-100 seconds
|
39 |
-
wait_time = random.randint(60, 100)
|
40 |
|
41 |
# Return redirect URL and wait time immediately
|
42 |
initial_response = {
|
43 |
'status': 'initiated',
|
44 |
-
'redirect_url': connection_request.redirectUrl,
|
45 |
'wait_time': wait_time,
|
46 |
'message': f'Please click the link below to authenticate. Waiting {wait_time} seconds for completion...'
|
47 |
}
|
@@ -64,8 +62,6 @@ class CalendarWrappedAPI:
|
|
64 |
def check_connection_status(self, entity_id):
|
65 |
"""Check the connection status using entity_id"""
|
66 |
if entity_id in self.connections:
|
67 |
-
wait_time = random.randint(60, 100)
|
68 |
-
time.sleep(wait_time)
|
69 |
return {
|
70 |
'status': self.connections[entity_id]['status'],
|
71 |
'wait_time': wait_time,
|
@@ -148,9 +144,7 @@ def create_gradio_api():
|
|
148 |
connect_btn = gr.Button("Initialize Connection")
|
149 |
|
150 |
# New outputs for better visibility
|
151 |
-
status_message = gr.Textbox(label="Status Message", interactive=False)
|
152 |
redirect_link = gr.HTML(label="Authentication Link")
|
153 |
-
connection_status = gr.Textbox(label="Connection Status", interactive=False)
|
154 |
|
155 |
connect_btn.click(
|
156 |
fn=handle_connection,
|
|
|
35 |
'redirect_url': connection_request.redirectUrl
|
36 |
}
|
37 |
|
|
|
|
|
38 |
|
39 |
# Return redirect URL and wait time immediately
|
40 |
initial_response = {
|
41 |
'status': 'initiated',
|
42 |
+
'redirect_url': '<a>'+connection_request.redirectUrl+'</a>',
|
43 |
'wait_time': wait_time,
|
44 |
'message': f'Please click the link below to authenticate. Waiting {wait_time} seconds for completion...'
|
45 |
}
|
|
|
62 |
def check_connection_status(self, entity_id):
|
63 |
"""Check the connection status using entity_id"""
|
64 |
if entity_id in self.connections:
|
|
|
|
|
65 |
return {
|
66 |
'status': self.connections[entity_id]['status'],
|
67 |
'wait_time': wait_time,
|
|
|
144 |
connect_btn = gr.Button("Initialize Connection")
|
145 |
|
146 |
# New outputs for better visibility
|
|
|
147 |
redirect_link = gr.HTML(label="Authentication Link")
|
|
|
148 |
|
149 |
connect_btn.click(
|
150 |
fn=handle_connection,
|