Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -38,7 +38,7 @@ class CalendarService:
|
|
38 |
def __init__(self):
|
39 |
self.toolset = ComposioToolSet(api_key=os.getenv('COMPOSIO_API_KEY'))
|
40 |
self.connections: Dict[str, Dict[str, Any]] = {}
|
41 |
-
|
42 |
def analyze_calendar_events(self, response_data):
|
43 |
"""
|
44 |
Analyze calendar events and return statistics about meetings.
|
@@ -133,6 +133,8 @@ class CalendarService:
|
|
133 |
'redirect_url': connection_request.redirectUrl,
|
134 |
'created_at': datetime.now().isoformat()
|
135 |
}
|
|
|
|
|
136 |
|
137 |
return APIResponse(
|
138 |
success=True,
|
@@ -152,22 +154,20 @@ class CalendarService:
|
|
152 |
|
153 |
def check_status(self, entity_id: str) -> APIResponse:
|
154 |
try:
|
155 |
-
|
|
|
|
|
|
|
|
|
|
|
156 |
return APIResponse(
|
157 |
-
success=
|
158 |
-
|
|
|
|
|
|
|
159 |
)
|
160 |
-
|
161 |
-
connection = self.connections[entity_id]
|
162 |
-
|
163 |
-
return APIResponse(
|
164 |
-
success=True,
|
165 |
-
data={
|
166 |
-
'status': connection['status'],
|
167 |
-
'message': f"Connection status: {connection['status']}"
|
168 |
-
}
|
169 |
-
)
|
170 |
-
|
171 |
except Exception as e:
|
172 |
return APIResponse(
|
173 |
success=False,
|
|
|
38 |
def __init__(self):
|
39 |
self.toolset = ComposioToolSet(api_key=os.getenv('COMPOSIO_API_KEY'))
|
40 |
self.connections: Dict[str, Dict[str, Any]] = {}
|
41 |
+
self.connectionRequest = None
|
42 |
def analyze_calendar_events(self, response_data):
|
43 |
"""
|
44 |
Analyze calendar events and return statistics about meetings.
|
|
|
133 |
'redirect_url': connection_request.redirectUrl,
|
134 |
'created_at': datetime.now().isoformat()
|
135 |
}
|
136 |
+
|
137 |
+
self.connectionRequest = connection_request
|
138 |
|
139 |
return APIResponse(
|
140 |
success=True,
|
|
|
154 |
|
155 |
def check_status(self, entity_id: str) -> APIResponse:
|
156 |
try:
|
157 |
+
status = self.connectionRequest.connectionStatus
|
158 |
+
|
159 |
+
if status == 'ACTIVE':
|
160 |
+
status='active'
|
161 |
+
connection = self.connections[entity_id]
|
162 |
+
|
163 |
return APIResponse(
|
164 |
+
success=True,
|
165 |
+
data={
|
166 |
+
'status': status,
|
167 |
+
'message': f"Connection status: {connection['status']}"
|
168 |
+
}
|
169 |
)
|
170 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
171 |
except Exception as e:
|
172 |
return APIResponse(
|
173 |
success=False,
|