Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -32,12 +32,6 @@ class CalendarWrappedAPI:
|
|
32 |
'redirect_url': connection_request.redirectUrl
|
33 |
}
|
34 |
|
35 |
-
# Print the redirect URL prominently
|
36 |
-
print("\n" + "="*50)
|
37 |
-
print("REDIRECT URL:")
|
38 |
-
print(connection_request.redirectUrl)
|
39 |
-
print("="*50 + "\n")
|
40 |
-
|
41 |
# Wait for random time between 60-100 seconds
|
42 |
wait_time = random.randint(60, 100)
|
43 |
print(f"Waiting for {wait_time} seconds before checking connection status...")
|
@@ -49,7 +43,7 @@ class CalendarWrappedAPI:
|
|
49 |
|
50 |
return {
|
51 |
'status': 'success',
|
52 |
-
'redirect_url': connection_request.redirectUrl,
|
53 |
'connection_status': final_status,
|
54 |
'wait_time': wait_time
|
55 |
}
|
@@ -112,7 +106,7 @@ def create_gradio_api():
|
|
112 |
result = api.initiate_connection(entity_id, redirect_url)
|
113 |
return {
|
114 |
**result,
|
115 |
-
'message': f"Connection initiated. Waited for {result.get('wait_time', 0)} seconds.
|
116 |
}
|
117 |
|
118 |
def check_status(entity_id):
|
@@ -139,7 +133,7 @@ def create_gradio_api():
|
|
139 |
placeholder="https://yourwebsite.com/connection/success"
|
140 |
)
|
141 |
connect_btn = gr.Button("Initialize Connection")
|
142 |
-
connection_output = gr.
|
143 |
|
144 |
connect_btn.click(
|
145 |
fn=handle_connection,
|
@@ -179,4 +173,4 @@ def create_gradio_api():
|
|
179 |
|
180 |
if __name__ == "__main__":
|
181 |
demo = create_gradio_api()
|
182 |
-
demo.launch(share=True)
|
|
|
32 |
'redirect_url': connection_request.redirectUrl
|
33 |
}
|
34 |
|
|
|
|
|
|
|
|
|
|
|
|
|
35 |
# Wait for random time between 60-100 seconds
|
36 |
wait_time = random.randint(60, 100)
|
37 |
print(f"Waiting for {wait_time} seconds before checking connection status...")
|
|
|
43 |
|
44 |
return {
|
45 |
'status': 'success',
|
46 |
+
'redirect_url': f'<a href="{connection_request.redirectUrl}" target="_blank">{connection_request.redirectUrl}</a>',
|
47 |
'connection_status': final_status,
|
48 |
'wait_time': wait_time
|
49 |
}
|
|
|
106 |
result = api.initiate_connection(entity_id, redirect_url)
|
107 |
return {
|
108 |
**result,
|
109 |
+
'message': f"Connection initiated. Waited for {result.get('wait_time', 0)} seconds."
|
110 |
}
|
111 |
|
112 |
def check_status(entity_id):
|
|
|
133 |
placeholder="https://yourwebsite.com/connection/success"
|
134 |
)
|
135 |
connect_btn = gr.Button("Initialize Connection")
|
136 |
+
connection_output = gr.HTML(label="Connection Status")
|
137 |
|
138 |
connect_btn.click(
|
139 |
fn=handle_connection,
|
|
|
173 |
|
174 |
if __name__ == "__main__":
|
175 |
demo = create_gradio_api()
|
176 |
+
demo.launch(share=True)
|