Update main.py
Browse files398 unmodified lines3994004014024034044056 unmodified lines412413414415416398 unmodified lines# Отключение бота от отложенного созвона@app.post("/delete_bot/event/")async def connect_bot(meeting_data: MeetingDeleteEvent, token: str = Depends(verify_token)):bot_id = meeting_data.bot_idlogger.info(f"Now delete bot with id: {bot_id} to {recall_url+bot_id}")headers = {6 unmodified lineslogger.info(f"Bot deleted to the meeting at with bot ID: {bot_id}")return {"status": "Bot deleted", "Bot ID": bot_id}else:logger.info(f"Request failed with status code {response.status_code}. ")return {"status": "Error", "Bot ID": bot_id}398 unmodified lines3994004014024034044054064074084094104114124134144154164174184194204214224236 unmodified lines430431432433434435436437438439440398 unmodified lines# Отключение бота от отложенного созвона@app.post("/delete_bot/event/")async def connect_bot(meeting_data: MeetingDeleteEvent, token: str = Depends(verify_token)):bot_id = meeting_data.bot_idvlogger.info(f"Now check status for delete bot with id: {bot_id} to {recall_url+bot_id}")headersRetrieve = {"Authorization": recall_authorization_token,}responseRetrieve = requests.get(recall_url+bot_id, headers=headersRetrieve).json()status_changes = response.get('status_changes', [])for status in status_changes:if status.get('code') == 'done':logger.info(f"Status done found for bot_id {bot_id}")return {"status": "Bot deleted", "Bot ID": bot_id}breakelse:logger.info(f"Status done not found for bot_id {bot_id}")logger.info(f"Now delete bot with id: {bot_id} to {recall_url+bot_id}")headers = {6 unmodified lineslogger.info(f"Bot deleted to the meeting at with bot ID: {bot_id}")return {"status": "Bot deleted", "Bot ID": bot_id}else:responseLeave = requests.post(recall_url+bot_id+'/leave_call/', headers=headersRetrieve)if responseLeave.status_code == 200:logger.info(f"Bot will leave from the meeting at with bot ID: {bot_id}")return {"status": "Bot deleted", "Bot ID": bot_id}else:logger.info(f"Request failed with status code {response.status_code}. ")return {"status": "Error", "Bot ID": bot_id}
main.py+27-3