Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -939,3 +939,22 @@ async def notifications(request: Request):
|
|
| 939 |
return {"message": "Notification received"}
|
| 940 |
except Exception as e:
|
| 941 |
raise HTTPException(status_code=500, detail=str(e))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 939 |
return {"message": "Notification received"}
|
| 940 |
except Exception as e:
|
| 941 |
raise HTTPException(status_code=500, detail=str(e))
|
| 942 |
+
|
| 943 |
+
@app.post("/close-channel")
|
| 944 |
+
async def close_channel():
|
| 945 |
+
"""
|
| 946 |
+
Endpoint to stop a notification channel for Google Drive.
|
| 947 |
+
"""
|
| 948 |
+
try:
|
| 949 |
+
|
| 950 |
+
# Call the stop method
|
| 951 |
+
request_body = {
|
| 952 |
+
'id': 'unique-channel-id',
|
| 953 |
+
'resourceId': '1exHTLZguA1kbLZMP0qiXGrFX8fOjHh3W',
|
| 954 |
+
}
|
| 955 |
+
|
| 956 |
+
drive_service.channels().stop(body=request_body).execute()
|
| 957 |
+
|
| 958 |
+
return {"message": "Channel closed successfully"}
|
| 959 |
+
except Exception as e:
|
| 960 |
+
raise HTTPException(status_code=500, detail=str(e))
|