From ef8487ebd5d2878af45d0fc74b10fc2474a96c73 Mon Sep 17 00:00:00 2001 From: tracyboehrer Date: Fri, 15 May 2020 11:29:35 -0500 Subject: [PATCH] Python: Now returning 200 instead of 201 (#2388) --- samples/python/02.echo-bot/app.py | 5 +++-- samples/python/03.welcome-user/app.py | 5 +++-- samples/python/05.multi-turn-prompt/app.py | 5 +++-- samples/python/06.using-cards/app.py | 5 +++-- samples/python/07.using-adaptive-cards/app.py | 5 +++-- samples/python/08.suggested-actions/app.py | 5 +++-- samples/python/11.qnamaker/app.py | 5 +++-- samples/python/13.core-bot/app.py | 5 +++-- samples/python/14.nlp-with-dispatch/app.py | 5 +++-- samples/python/15.handling-attachments/app.py | 5 +++-- samples/python/16.proactive-messages/app.py | 7 ++++--- samples/python/17.multilingual-bot/app.py | 5 +++-- samples/python/18.bot-authentication/app.py | 5 +++-- samples/python/19.custom-dialogs/app.py | 5 +++-- samples/python/21.corebot-app-insights/app.py | 5 +++-- samples/python/23.facebook-events/app.py | 5 +++-- samples/python/24.bot-authentication-msgraph/app.py | 5 +++-- samples/python/42.scaleout/app.py | 5 +++-- samples/python/43.complex-dialog/app.py | 5 +++-- samples/python/44.prompt-for-user-input/app.py | 5 +++-- samples/python/45.state-management/app.py | 5 +++-- samples/python/46.teams-auth/app.py | 5 +++-- samples/python/47.inspection/app.py | 5 +++-- samples/python/50.teams-messaging-extension-search/app.py | 5 +++-- samples/python/51.teams-messaging-extensions-action/app.py | 5 +++-- .../app.py | 5 +++-- .../53.teams-messaging-extensions-action-preview/app.py | 5 +++-- samples/python/54.teams-task-module/app.py | 5 +++-- samples/python/55.teams-link-unfurling/app.py | 5 +++-- samples/python/56.teams-file-upload/app.py | 5 +++-- samples/python/57.teams-conversation-bot/app.py | 5 +++-- samples/python/58.teams-start-thread-in-channel/app.py | 5 +++-- 32 files changed, 97 insertions(+), 65 deletions(-) diff --git a/samples/python/02.echo-bot/app.py b/samples/python/02.echo-bot/app.py index 450c22b17a..29526fa449 100644 --- a/samples/python/02.echo-bot/app.py +++ b/samples/python/02.echo-bot/app.py @@ -4,6 +4,7 @@ import sys import traceback from datetime import datetime +from http import HTTPStatus from aiohttp import web from aiohttp.web import Request, Response, json_response @@ -66,7 +67,7 @@ async def messages(req: Request) -> Response: if "application/json" in req.headers["Content-Type"]: body = await req.json() else: - return Response(status=415) + return Response(status=HTTPStatus.UNSUPPORTED_MEDIA_TYPE) activity = Activity().deserialize(body) auth_header = req.headers["Authorization"] if "Authorization" in req.headers else "" @@ -74,7 +75,7 @@ async def messages(req: Request) -> Response: response = await ADAPTER.process_activity(activity, auth_header, BOT.on_turn) if response: return json_response(data=response.body, status=response.status) - return Response(status=201) + return Response(status=HTTPStatus.OK) APP = web.Application(middlewares=[aiohttp_error_middleware]) diff --git a/samples/python/03.welcome-user/app.py b/samples/python/03.welcome-user/app.py index 92780db522..089747efa1 100644 --- a/samples/python/03.welcome-user/app.py +++ b/samples/python/03.welcome-user/app.py @@ -4,6 +4,7 @@ import sys import traceback from datetime import datetime +from http import HTTPStatus from aiohttp import web from aiohttp.web import Request, Response, json_response @@ -72,7 +73,7 @@ async def messages(req: Request) -> Response: if "application/json" in req.headers["Content-Type"]: body = await req.json() else: - return Response(status=415) + return Response(status=HTTPStatus.UNSUPPORTED_MEDIA_TYPE) activity = Activity().deserialize(body) auth_header = req.headers["Authorization"] if "Authorization" in req.headers else "" @@ -80,7 +81,7 @@ async def messages(req: Request) -> Response: response = await ADAPTER.process_activity(activity, auth_header, BOT.on_turn) if response: return json_response(data=response.body, status=response.status) - return Response(status=201) + return Response(status=HTTPStatus.OK) APP = web.Application(middlewares=[aiohttp_error_middleware]) diff --git a/samples/python/05.multi-turn-prompt/app.py b/samples/python/05.multi-turn-prompt/app.py index bed6a7e759..0c8de92b6f 100644 --- a/samples/python/05.multi-turn-prompt/app.py +++ b/samples/python/05.multi-turn-prompt/app.py @@ -4,6 +4,7 @@ import sys import traceback from datetime import datetime +from http import HTTPStatus from aiohttp import web from aiohttp.web import Request, Response, json_response @@ -82,7 +83,7 @@ async def messages(req: Request) -> Response: if "application/json" in req.headers["Content-Type"]: body = await req.json() else: - return Response(status=415) + return Response(status=HTTPStatus.UNSUPPORTED_MEDIA_TYPE) activity = Activity().deserialize(body) auth_header = req.headers["Authorization"] if "Authorization" in req.headers else "" @@ -90,7 +91,7 @@ async def messages(req: Request) -> Response: response = await ADAPTER.process_activity(activity, auth_header, BOT.on_turn) if response: return json_response(data=response.body, status=response.status) - return Response(status=201) + return Response(status=HTTPStatus.OK) APP = web.Application(middlewares=[aiohttp_error_middleware]) diff --git a/samples/python/06.using-cards/app.py b/samples/python/06.using-cards/app.py index 13eed1db7d..ae5646a0f9 100644 --- a/samples/python/06.using-cards/app.py +++ b/samples/python/06.using-cards/app.py @@ -4,6 +4,7 @@ import sys import traceback from datetime import datetime +from http import HTTPStatus from aiohttp import web from aiohttp.web import Request, Response, json_response @@ -81,7 +82,7 @@ async def messages(req: Request) -> Response: if "application/json" in req.headers["Content-Type"]: body = await req.json() else: - return Response(status=415) + return Response(status=HTTPStatus.UNSUPPORTED_MEDIA_TYPE) activity = Activity().deserialize(body) auth_header = req.headers["Authorization"] if "Authorization" in req.headers else "" @@ -89,7 +90,7 @@ async def messages(req: Request) -> Response: response = await ADAPTER.process_activity(activity, auth_header, BOT.on_turn) if response: return json_response(data=response.body, status=response.status) - return Response(status=201) + return Response(status=HTTPStatus.OK) APP = web.Application(middlewares=[aiohttp_error_middleware]) diff --git a/samples/python/07.using-adaptive-cards/app.py b/samples/python/07.using-adaptive-cards/app.py index 7c6e1ebf0a..e88cd5af91 100644 --- a/samples/python/07.using-adaptive-cards/app.py +++ b/samples/python/07.using-adaptive-cards/app.py @@ -4,6 +4,7 @@ import sys import traceback from datetime import datetime +from http import HTTPStatus from aiohttp import web from aiohttp.web import Request, Response, json_response @@ -66,7 +67,7 @@ async def messages(req: Request) -> Response: if "application/json" in req.headers["Content-Type"]: body = await req.json() else: - return Response(status=415) + return Response(status=HTTPStatus.UNSUPPORTED_MEDIA_TYPE) activity = Activity().deserialize(body) auth_header = req.headers["Authorization"] if "Authorization" in req.headers else "" @@ -74,7 +75,7 @@ async def messages(req: Request) -> Response: response = await ADAPTER.process_activity(activity, auth_header, BOT.on_turn) if response: return json_response(data=response.body, status=response.status) - return Response(status=201) + return Response(status=HTTPStatus.OK) APP = web.Application(middlewares=[aiohttp_error_middleware]) diff --git a/samples/python/08.suggested-actions/app.py b/samples/python/08.suggested-actions/app.py index f097480d5e..d2179140b2 100644 --- a/samples/python/08.suggested-actions/app.py +++ b/samples/python/08.suggested-actions/app.py @@ -4,6 +4,7 @@ import sys import traceback from datetime import datetime +from http import HTTPStatus from aiohttp import web from aiohttp.web import Request, Response, json_response @@ -66,7 +67,7 @@ async def messages(req: Request) -> Response: if "application/json" in req.headers["Content-Type"]: body = await req.json() else: - return Response(status=415) + return Response(status=HTTPStatus.UNSUPPORTED_MEDIA_TYPE) activity = Activity().deserialize(body) auth_header = req.headers["Authorization"] if "Authorization" in req.headers else "" @@ -74,7 +75,7 @@ async def messages(req: Request) -> Response: response = await ADAPTER.process_activity(activity, auth_header, BOT.on_turn) if response: return json_response(data=response.body, status=response.status) - return Response(status=201) + return Response(status=HTTPStatus.OK) APP = web.Application(middlewares=[aiohttp_error_middleware]) diff --git a/samples/python/11.qnamaker/app.py b/samples/python/11.qnamaker/app.py index a051538d1e..2b56f6aedd 100644 --- a/samples/python/11.qnamaker/app.py +++ b/samples/python/11.qnamaker/app.py @@ -4,6 +4,7 @@ import sys import traceback from datetime import datetime +from http import HTTPStatus from aiohttp import web from aiohttp.web import Request, Response, json_response @@ -66,7 +67,7 @@ async def messages(req: Request) -> Response: if "application/json" in req.headers["Content-Type"]: body = await req.json() else: - return Response(status=415) + return Response(status=HTTPStatus.UNSUPPORTED_MEDIA_TYPE) activity = Activity().deserialize(body) auth_header = req.headers["Authorization"] if "Authorization" in req.headers else "" @@ -74,7 +75,7 @@ async def messages(req: Request) -> Response: response = await ADAPTER.process_activity(activity, auth_header, BOT.on_turn) if response: return json_response(data=response.body, status=response.status) - return Response(status=201) + return Response(status=HTTPStatus.OK) APP = web.Application(middlewares=[aiohttp_error_middleware]) diff --git a/samples/python/13.core-bot/app.py b/samples/python/13.core-bot/app.py index 723cade647..10bb7a17cc 100644 --- a/samples/python/13.core-bot/app.py +++ b/samples/python/13.core-bot/app.py @@ -8,6 +8,7 @@ - Handle user interruptions for such things as `Help` or `Cancel`. - Prompt for and validate requests for information from the user. """ +from http import HTTPStatus from aiohttp import web from aiohttp.web import Request, Response, json_response @@ -55,7 +56,7 @@ async def messages(req: Request) -> Response: if "application/json" in req.headers["Content-Type"]: body = await req.json() else: - return Response(status=415) + return Response(status=HTTPStatus.UNSUPPORTED_MEDIA_TYPE) activity = Activity().deserialize(body) auth_header = req.headers["Authorization"] if "Authorization" in req.headers else "" @@ -63,7 +64,7 @@ async def messages(req: Request) -> Response: response = await ADAPTER.process_activity(activity, auth_header, BOT.on_turn) if response: return json_response(data=response.body, status=response.status) - return Response(status=201) + return Response(status=HTTPStatus.OK) APP = web.Application(middlewares=[aiohttp_error_middleware]) diff --git a/samples/python/14.nlp-with-dispatch/app.py b/samples/python/14.nlp-with-dispatch/app.py index 9b162451f7..4caec3e961 100644 --- a/samples/python/14.nlp-with-dispatch/app.py +++ b/samples/python/14.nlp-with-dispatch/app.py @@ -4,6 +4,7 @@ import sys import traceback from datetime import datetime +from http import HTTPStatus from aiohttp import web from aiohttp.web import Request, Response, json_response @@ -66,7 +67,7 @@ async def messages(req: Request) -> Response: if "application/json" in req.headers["Content-Type"]: body = await req.json() else: - return Response(status=415) + return Response(status=HTTPStatus.UNSUPPORTED_MEDIA_TYPE) activity = Activity().deserialize(body) auth_header = req.headers["Authorization"] if "Authorization" in req.headers else "" @@ -74,7 +75,7 @@ async def messages(req: Request) -> Response: response = await ADAPTER.process_activity(activity, auth_header, BOT.on_turn) if response: return json_response(data=response.body, status=response.status) - return Response(status=201) + return Response(status=HTTPStatus.OK) APP = web.Application(middlewares=[aiohttp_error_middleware]) diff --git a/samples/python/15.handling-attachments/app.py b/samples/python/15.handling-attachments/app.py index dc04739e2f..fe58108648 100644 --- a/samples/python/15.handling-attachments/app.py +++ b/samples/python/15.handling-attachments/app.py @@ -4,6 +4,7 @@ import sys import traceback from datetime import datetime +from http import HTTPStatus from aiohttp import web from aiohttp.web import Request, Response, json_response @@ -66,7 +67,7 @@ async def messages(req: Request) -> Response: if "application/json" in req.headers["Content-Type"]: body = await req.json() else: - return Response(status=415) + return Response(status=HTTPStatus.UNSUPPORTED_MEDIA_TYPE) activity = Activity().deserialize(body) auth_header = req.headers["Authorization"] if "Authorization" in req.headers else "" @@ -74,7 +75,7 @@ async def messages(req: Request) -> Response: response = await ADAPTER.process_activity(activity, auth_header, BOT.on_turn) if response: return json_response(data=response.body, status=response.status) - return Response(status=201) + return Response(status=HTTPStatus.OK) APP = web.Application(middlewares=[aiohttp_error_middleware]) diff --git a/samples/python/16.proactive-messages/app.py b/samples/python/16.proactive-messages/app.py index 761f0db5e2..9ea7197221 100644 --- a/samples/python/16.proactive-messages/app.py +++ b/samples/python/16.proactive-messages/app.py @@ -5,6 +5,7 @@ import traceback import uuid from datetime import datetime +from http import HTTPStatus from typing import Dict from aiohttp import web @@ -77,7 +78,7 @@ async def messages(req: Request) -> Response: if "application/json" in req.headers["Content-Type"]: body = await req.json() else: - return Response(status=415) + return Response(status=HTTPStatus.UNSUPPORTED_MEDIA_TYPE) activity = Activity().deserialize(body) auth_header = req.headers["Authorization"] if "Authorization" in req.headers else "" @@ -85,13 +86,13 @@ async def messages(req: Request) -> Response: response = await ADAPTER.process_activity(activity, auth_header, BOT.on_turn) if response: return json_response(data=response.body, status=response.status) - return Response(status=201) + return Response(status=HTTPStatus.OK) # Listen for requests on /api/notify, and send a messages to all conversation members. async def notify(req: Request) -> Response: # pylint: disable=unused-argument await _send_proactive_message() - return Response(status=201, text="Proactive messages have been sent") + return Response(status=HTTPStatus.OK, text="Proactive messages have been sent") # Send a message to all conversation members. diff --git a/samples/python/17.multilingual-bot/app.py b/samples/python/17.multilingual-bot/app.py index 36f55e160c..5e94ca4101 100644 --- a/samples/python/17.multilingual-bot/app.py +++ b/samples/python/17.multilingual-bot/app.py @@ -4,6 +4,7 @@ import sys import traceback from datetime import datetime +from http import HTTPStatus from aiohttp import web from aiohttp.web import Request, Response, json_response @@ -80,7 +81,7 @@ async def messages(req: Request) -> Response: if "application/json" in req.headers["Content-Type"]: body = await req.json() else: - return Response(status=415) + return Response(status=HTTPStatus.UNSUPPORTED_MEDIA_TYPE) activity = Activity().deserialize(body) auth_header = req.headers["Authorization"] if "Authorization" in req.headers else "" @@ -88,7 +89,7 @@ async def messages(req: Request) -> Response: response = await ADAPTER.process_activity(activity, auth_header, BOT.on_turn) if response: return json_response(data=response.body, status=response.status) - return Response(status=201) + return Response(status=HTTPStatus.OK) APP = web.Application(middlewares=[aiohttp_error_middleware]) diff --git a/samples/python/18.bot-authentication/app.py b/samples/python/18.bot-authentication/app.py index 8f1c934eac..cb310ca651 100644 --- a/samples/python/18.bot-authentication/app.py +++ b/samples/python/18.bot-authentication/app.py @@ -4,6 +4,7 @@ import sys import traceback from datetime import datetime +from http import HTTPStatus from aiohttp import web from aiohttp.web import Request, Response, json_response @@ -81,7 +82,7 @@ async def messages(req: Request) -> Response: if "application/json" in req.headers["Content-Type"]: body = await req.json() else: - return Response(status=415) + return Response(status=HTTPStatus.UNSUPPORTED_MEDIA_TYPE) activity = Activity().deserialize(body) auth_header = req.headers["Authorization"] if "Authorization" in req.headers else "" @@ -89,7 +90,7 @@ async def messages(req: Request) -> Response: response = await ADAPTER.process_activity(activity, auth_header, BOT.on_turn) if response: return json_response(data=response.body, status=response.status) - return Response(status=201) + return Response(status=HTTPStatus.OK) APP = web.Application(middlewares=[aiohttp_error_middleware]) diff --git a/samples/python/19.custom-dialogs/app.py b/samples/python/19.custom-dialogs/app.py index 8c3fe38cbe..5b7bf470cb 100644 --- a/samples/python/19.custom-dialogs/app.py +++ b/samples/python/19.custom-dialogs/app.py @@ -4,6 +4,7 @@ import sys import traceback from datetime import datetime +from http import HTTPStatus from aiohttp import web from aiohttp.web import Request, Response, json_response @@ -78,7 +79,7 @@ async def messages(req: Request) -> Response: if "application/json" in req.headers["Content-Type"]: body = await req.json() else: - return Response(status=415) + return Response(status=HTTPStatus.UNSUPPORTED_MEDIA_TYPE) activity = Activity().deserialize(body) auth_header = req.headers["Authorization"] if "Authorization" in req.headers else "" @@ -86,7 +87,7 @@ async def messages(req: Request) -> Response: response = await ADAPTER.process_activity(activity, auth_header, BOT.on_turn) if response: return json_response(data=response.body, status=response.status) - return Response(status=201) + return Response(status=HTTPStatus.OK) APP = web.Application(middlewares=[aiohttp_error_middleware]) diff --git a/samples/python/21.corebot-app-insights/app.py b/samples/python/21.corebot-app-insights/app.py index 7acbc44f44..1100615b38 100644 --- a/samples/python/21.corebot-app-insights/app.py +++ b/samples/python/21.corebot-app-insights/app.py @@ -8,6 +8,7 @@ - Handle user interruptions for such things as `Help` or `Cancel`. - Prompt for and validate requests for information from the user. """ +from http import HTTPStatus from aiohttp import web from aiohttp.web import Request, Response, json_response @@ -66,7 +67,7 @@ async def messages(req: Request) -> Response: if "application/json" in req.headers["Content-Type"]: body = await req.json() else: - return Response(status=415) + return Response(status=HTTPStatus.UNSUPPORTED_MEDIA_TYPE) activity = Activity().deserialize(body) auth_header = req.headers["Authorization"] if "Authorization" in req.headers else "" @@ -74,7 +75,7 @@ async def messages(req: Request) -> Response: response = await ADAPTER.process_activity(activity, auth_header, BOT.on_turn) if response: return json_response(data=response.body, status=response.status) - return Response(status=201) + return Response(status=HTTPStatus.OK) APP = web.Application(middlewares=[bot_telemetry_middleware, aiohttp_error_middleware]) diff --git a/samples/python/23.facebook-events/app.py b/samples/python/23.facebook-events/app.py index 5aa1b87ab0..a8242fb371 100644 --- a/samples/python/23.facebook-events/app.py +++ b/samples/python/23.facebook-events/app.py @@ -4,6 +4,7 @@ import sys import traceback from datetime import datetime +from http import HTTPStatus from aiohttp import web from aiohttp.web import Request, Response, json_response @@ -66,7 +67,7 @@ async def messages(req: Request) -> Response: if "application/json" in req.headers["Content-Type"]: body = await req.json() else: - return Response(status=415) + return Response(status=HTTPStatus.UNSUPPORTED_MEDIA_TYPE) activity = Activity().deserialize(body) auth_header = req.headers["Authorization"] if "Authorization" in req.headers else "" @@ -74,7 +75,7 @@ async def messages(req: Request) -> Response: response = await ADAPTER.process_activity(activity, auth_header, BOT.on_turn) if response: return json_response(data=response.body, status=response.status) - return Response(status=201) + return Response(status=HTTPStatus.OK) APP = web.Application(middlewares=[aiohttp_error_middleware]) diff --git a/samples/python/24.bot-authentication-msgraph/app.py b/samples/python/24.bot-authentication-msgraph/app.py index 8f1c934eac..cb310ca651 100644 --- a/samples/python/24.bot-authentication-msgraph/app.py +++ b/samples/python/24.bot-authentication-msgraph/app.py @@ -4,6 +4,7 @@ import sys import traceback from datetime import datetime +from http import HTTPStatus from aiohttp import web from aiohttp.web import Request, Response, json_response @@ -81,7 +82,7 @@ async def messages(req: Request) -> Response: if "application/json" in req.headers["Content-Type"]: body = await req.json() else: - return Response(status=415) + return Response(status=HTTPStatus.UNSUPPORTED_MEDIA_TYPE) activity = Activity().deserialize(body) auth_header = req.headers["Authorization"] if "Authorization" in req.headers else "" @@ -89,7 +90,7 @@ async def messages(req: Request) -> Response: response = await ADAPTER.process_activity(activity, auth_header, BOT.on_turn) if response: return json_response(data=response.body, status=response.status) - return Response(status=201) + return Response(status=HTTPStatus.OK) APP = web.Application(middlewares=[aiohttp_error_middleware]) diff --git a/samples/python/42.scaleout/app.py b/samples/python/42.scaleout/app.py index 02691e2510..dc299ae17c 100644 --- a/samples/python/42.scaleout/app.py +++ b/samples/python/42.scaleout/app.py @@ -4,6 +4,7 @@ import sys import traceback from datetime import datetime +from http import HTTPStatus from aiohttp import web from aiohttp.web import Request, Response, json_response @@ -74,7 +75,7 @@ async def messages(req: Request) -> Response: if "application/json" in req.headers["Content-Type"]: body = await req.json() else: - return Response(status=415) + return Response(status=HTTPStatus.UNSUPPORTED_MEDIA_TYPE) activity = Activity().deserialize(body) auth_header = req.headers["Authorization"] if "Authorization" in req.headers else "" @@ -82,7 +83,7 @@ async def messages(req: Request) -> Response: response = await ADAPTER.process_activity(activity, auth_header, BOT.on_turn) if response: return json_response(data=response.body, status=response.status) - return Response(status=201) + return Response(status=HTTPStatus.OK) APP = web.Application(middlewares=[aiohttp_error_middleware]) diff --git a/samples/python/43.complex-dialog/app.py b/samples/python/43.complex-dialog/app.py index d675835c40..85036cef48 100644 --- a/samples/python/43.complex-dialog/app.py +++ b/samples/python/43.complex-dialog/app.py @@ -4,6 +4,7 @@ import sys import traceback from datetime import datetime +from http import HTTPStatus from aiohttp import web from aiohttp.web import Request, Response, json_response @@ -83,7 +84,7 @@ async def messages(req: Request) -> Response: if "application/json" in req.headers["Content-Type"]: body = await req.json() else: - return Response(status=415) + return Response(status=HTTPStatus.UNSUPPORTED_MEDIA_TYPE) activity = Activity().deserialize(body) auth_header = req.headers["Authorization"] if "Authorization" in req.headers else "" @@ -91,7 +92,7 @@ async def messages(req: Request) -> Response: response = await ADAPTER.process_activity(activity, auth_header, BOT.on_turn) if response: return json_response(data=response.body, status=response.status) - return Response(status=201) + return Response(status=HTTPStatus.OK) APP = web.Application(middlewares=[aiohttp_error_middleware]) diff --git a/samples/python/44.prompt-for-user-input/app.py b/samples/python/44.prompt-for-user-input/app.py index e8f6bfdf4e..6a9de102f7 100644 --- a/samples/python/44.prompt-for-user-input/app.py +++ b/samples/python/44.prompt-for-user-input/app.py @@ -4,6 +4,7 @@ import sys import traceback from datetime import datetime +from http import HTTPStatus from aiohttp import web from aiohttp.web import Request, Response, json_response @@ -79,7 +80,7 @@ async def messages(req: Request) -> Response: if "application/json" in req.headers["Content-Type"]: body = await req.json() else: - return Response(status=415) + return Response(status=HTTPStatus.UNSUPPORTED_MEDIA_TYPE) activity = Activity().deserialize(body) auth_header = req.headers["Authorization"] if "Authorization" in req.headers else "" @@ -87,7 +88,7 @@ async def messages(req: Request) -> Response: response = await ADAPTER.process_activity(activity, auth_header, BOT.on_turn) if response: return json_response(data=response.body, status=response.status) - return Response(status=201) + return Response(status=HTTPStatus.OK) APP = web.Application(middlewares=[aiohttp_error_middleware]) diff --git a/samples/python/45.state-management/app.py b/samples/python/45.state-management/app.py index 9e71ec9a73..27434aa0cc 100644 --- a/samples/python/45.state-management/app.py +++ b/samples/python/45.state-management/app.py @@ -4,6 +4,7 @@ import sys import traceback from datetime import datetime +from http import HTTPStatus from aiohttp import web from aiohttp.web import Request, Response, json_response @@ -79,7 +80,7 @@ async def messages(req: Request) -> Response: if "application/json" in req.headers["Content-Type"]: body = await req.json() else: - return Response(status=415) + return Response(status=HTTPStatus.UNSUPPORTED_MEDIA_TYPE) activity = Activity().deserialize(body) auth_header = req.headers["Authorization"] if "Authorization" in req.headers else "" @@ -87,7 +88,7 @@ async def messages(req: Request) -> Response: response = await ADAPTER.process_activity(activity, auth_header, BOT.on_turn) if response: return json_response(data=response.body, status=response.status) - return Response(status=201) + return Response(status=HTTPStatus.OK) APP = web.Application(middlewares=[aiohttp_error_middleware]) diff --git a/samples/python/46.teams-auth/app.py b/samples/python/46.teams-auth/app.py index 0325349987..1243151f7d 100644 --- a/samples/python/46.teams-auth/app.py +++ b/samples/python/46.teams-auth/app.py @@ -4,6 +4,7 @@ import sys import traceback from datetime import datetime +from http import HTTPStatus from aiohttp import web from aiohttp.web import Request, Response, json_response @@ -81,7 +82,7 @@ async def messages(req: Request) -> Response: if "application/json" in req.headers["Content-Type"]: body = await req.json() else: - return Response(status=415) + return Response(status=HTTPStatus.UNSUPPORTED_MEDIA_TYPE) activity = Activity().deserialize(body) auth_header = req.headers["Authorization"] if "Authorization" in req.headers else "" @@ -89,7 +90,7 @@ async def messages(req: Request) -> Response: invoke_response = await ADAPTER.process_activity(activity, auth_header, BOT.on_turn) if invoke_response: return json_response(data=invoke_response.body, status=invoke_response.status) - return Response(status=201) + return Response(status=HTTPStatus.OK) APP = web.Application(middlewares=[aiohttp_error_middleware]) diff --git a/samples/python/47.inspection/app.py b/samples/python/47.inspection/app.py index ccabd1fff7..73869a72b1 100644 --- a/samples/python/47.inspection/app.py +++ b/samples/python/47.inspection/app.py @@ -4,6 +4,7 @@ import sys import traceback from datetime import datetime +from http import HTTPStatus from aiohttp import web from aiohttp.web import Request, Response, json_response @@ -93,7 +94,7 @@ async def messages(req: Request) -> Response: if "application/json" in req.headers["Content-Type"]: body = await req.json() else: - return Response(status=415) + return Response(status=HTTPStatus.UNSUPPORTED_MEDIA_TYPE) activity = Activity().deserialize(body) auth_header = req.headers["Authorization"] if "Authorization" in req.headers else "" @@ -101,7 +102,7 @@ async def messages(req: Request) -> Response: response = await ADAPTER.process_activity(activity, auth_header, BOT.on_turn) if response: return json_response(data=response.body, status=response.status) - return Response(status=201) + return Response(status=HTTPStatus.OK) APP = web.Application(middlewares=[aiohttp_error_middleware]) diff --git a/samples/python/50.teams-messaging-extension-search/app.py b/samples/python/50.teams-messaging-extension-search/app.py index 44c38b2364..354d0ef5cc 100644 --- a/samples/python/50.teams-messaging-extension-search/app.py +++ b/samples/python/50.teams-messaging-extension-search/app.py @@ -4,6 +4,7 @@ import sys import traceback from datetime import datetime +from http import HTTPStatus from aiohttp import web from aiohttp.web import Request, Response, json_response @@ -67,7 +68,7 @@ async def messages(req: Request) -> Response: if "application/json" in req.headers["Content-Type"]: body = await req.json() else: - return Response(status=415) + return Response(status=HTTPStatus.UNSUPPORTED_MEDIA_TYPE) activity = Activity().deserialize(body) auth_header = req.headers["Authorization"] if "Authorization" in req.headers else "" @@ -75,7 +76,7 @@ async def messages(req: Request) -> Response: response = await ADAPTER.process_activity(activity, auth_header, BOT.on_turn) if response: return json_response(data=response.body, status=response.status) - return Response(status=201) + return Response(status=HTTPStatus.OK) APP = web.Application(middlewares=[aiohttp_error_middleware]) diff --git a/samples/python/51.teams-messaging-extensions-action/app.py b/samples/python/51.teams-messaging-extensions-action/app.py index 069a5c222f..ceca895904 100644 --- a/samples/python/51.teams-messaging-extensions-action/app.py +++ b/samples/python/51.teams-messaging-extensions-action/app.py @@ -4,6 +4,7 @@ import sys import traceback from datetime import datetime +from http import HTTPStatus from aiohttp import web from aiohttp.web import Request, Response, json_response @@ -65,7 +66,7 @@ async def messages(req: Request) -> Response: if "application/json" in req.headers["Content-Type"]: body = await req.json() else: - return Response(status=415) + return Response(status=HTTPStatus.UNSUPPORTED_MEDIA_TYPE) activity = Activity().deserialize(body) auth_header = req.headers["Authorization"] if "Authorization" in req.headers else "" @@ -77,7 +78,7 @@ async def messages(req: Request) -> Response: return json_response( data=invoke_response.body, status=invoke_response.status ) - return Response(status=201) + return Response(status=HTTPStatus.OK) APP = web.Application(middlewares=[aiohttp_error_middleware]) diff --git a/samples/python/52.teams-messaging-extensions-search-auth-config/app.py b/samples/python/52.teams-messaging-extensions-search-auth-config/app.py index c238705de6..9c0d33790d 100644 --- a/samples/python/52.teams-messaging-extensions-search-auth-config/app.py +++ b/samples/python/52.teams-messaging-extensions-search-auth-config/app.py @@ -4,6 +4,7 @@ import sys import traceback from datetime import datetime +from http import HTTPStatus from aiohttp import web from aiohttp.web import Request, Response, json_response @@ -75,7 +76,7 @@ async def messages(req: Request) -> Response: if "application/json" in req.headers["Content-Type"]: body = await req.json() else: - return Response(status=415) + return Response(status=HTTPStatus.UNSUPPORTED_MEDIA_TYPE) activity = Activity().deserialize(body) auth_header = req.headers["Authorization"] if "Authorization" in req.headers else "" @@ -87,7 +88,7 @@ async def messages(req: Request) -> Response: return json_response( data=invoke_response.body, status=invoke_response.status ) - return Response(status=201) + return Response(status=HTTPStatus.OK) APP = web.Application(middlewares=[aiohttp_error_middleware]) diff --git a/samples/python/53.teams-messaging-extensions-action-preview/app.py b/samples/python/53.teams-messaging-extensions-action-preview/app.py index 7e620deb9a..6ab70e97c0 100644 --- a/samples/python/53.teams-messaging-extensions-action-preview/app.py +++ b/samples/python/53.teams-messaging-extensions-action-preview/app.py @@ -5,6 +5,7 @@ import sys import traceback from datetime import datetime +from http import HTTPStatus from aiohttp import web from aiohttp.web import Request, Response, json_response @@ -66,7 +67,7 @@ async def messages(req: Request) -> Response: if "application/json" in req.headers["Content-Type"]: body = await req.json() else: - return Response(status=415) + return Response(status=HTTPStatus.UNSUPPORTED_MEDIA_TYPE) activity = Activity().deserialize(body) auth_header = req.headers["Authorization"] if "Authorization" in req.headers else "" @@ -78,7 +79,7 @@ async def messages(req: Request) -> Response: return json_response( data=invoke_response.body, status=invoke_response.status ) - return Response(status=201) + return Response(status=HTTPStatus.OK) APP = web.Application(middlewares=[aiohttp_error_middleware]) diff --git a/samples/python/54.teams-task-module/app.py b/samples/python/54.teams-task-module/app.py index 08767e9a8e..9f6ce6a4b7 100644 --- a/samples/python/54.teams-task-module/app.py +++ b/samples/python/54.teams-task-module/app.py @@ -4,6 +4,7 @@ import sys import traceback from datetime import datetime +from http import HTTPStatus from aiohttp import web from aiohttp.web import Request, Response, json_response @@ -65,7 +66,7 @@ async def messages(req: Request) -> Response: if "application/json" in req.headers["Content-Type"]: body = await req.json() else: - return Response(status=415) + return Response(status=HTTPStatus.UNSUPPORTED_MEDIA_TYPE) activity = Activity().deserialize(body) auth_header = req.headers["Authorization"] if "Authorization" in req.headers else "" @@ -77,7 +78,7 @@ async def messages(req: Request) -> Response: return json_response( data=invoke_response.body, status=invoke_response.status ) - return Response(status=201) + return Response(status=HTTPStatus.OK) APP = web.Application(middlewares=[aiohttp_error_middleware]) diff --git a/samples/python/55.teams-link-unfurling/app.py b/samples/python/55.teams-link-unfurling/app.py index 3e2b2bd992..15068e73b2 100644 --- a/samples/python/55.teams-link-unfurling/app.py +++ b/samples/python/55.teams-link-unfurling/app.py @@ -4,6 +4,7 @@ import sys import traceback from datetime import datetime +from http import HTTPStatus from aiohttp import web from aiohttp.web import Request, Response, json_response @@ -66,7 +67,7 @@ async def messages(req: Request) -> Response: if "application/json" in req.headers["Content-Type"]: body = await req.json() else: - return Response(status=415) + return Response(status=HTTPStatus.UNSUPPORTED_MEDIA_TYPE) activity = Activity().deserialize(body) auth_header = req.headers["Authorization"] if "Authorization" in req.headers else "" @@ -78,7 +79,7 @@ async def messages(req: Request) -> Response: return json_response( data=invoke_response.body, status=invoke_response.status ) - return Response(status=201) + return Response(status=HTTPStatus.OK) APP = web.Application(middlewares=[aiohttp_error_middleware]) diff --git a/samples/python/56.teams-file-upload/app.py b/samples/python/56.teams-file-upload/app.py index 994ce65b4b..535f6faa18 100644 --- a/samples/python/56.teams-file-upload/app.py +++ b/samples/python/56.teams-file-upload/app.py @@ -4,6 +4,7 @@ import sys import traceback from datetime import datetime +from http import HTTPStatus from aiohttp import web from aiohttp.web import Request, Response, json_response @@ -66,7 +67,7 @@ async def messages(req: Request) -> Response: if "application/json" in req.headers["Content-Type"]: body = await req.json() else: - return Response(status=415) + return Response(status=HTTPStatus.UNSUPPORTED_MEDIA_TYPE) activity = Activity().deserialize(body) auth_header = req.headers["Authorization"] if "Authorization" in req.headers else "" @@ -78,7 +79,7 @@ async def messages(req: Request) -> Response: return json_response( data=invoke_response.body, status=invoke_response.status ) - return Response(status=201) + return Response(status=HTTPStatus.OK) APP = web.Application(middlewares=[aiohttp_error_middleware]) diff --git a/samples/python/57.teams-conversation-bot/app.py b/samples/python/57.teams-conversation-bot/app.py index 18fd6e2d24..1ed01df2b5 100644 --- a/samples/python/57.teams-conversation-bot/app.py +++ b/samples/python/57.teams-conversation-bot/app.py @@ -5,6 +5,7 @@ import traceback import uuid from datetime import datetime +from http import HTTPStatus from aiohttp import web from aiohttp.web import Request, Response, json_response @@ -72,7 +73,7 @@ async def messages(req: Request) -> Response: if "application/json" in req.headers["Content-Type"]: body = await req.json() else: - return Response(status=415) + return Response(status=HTTPStatus.UNSUPPORTED_MEDIA_TYPE) activity = Activity().deserialize(body) auth_header = req.headers["Authorization"] if "Authorization" in req.headers else "" @@ -80,7 +81,7 @@ async def messages(req: Request) -> Response: response = await ADAPTER.process_activity(activity, auth_header, BOT.on_turn) if response: return json_response(data=response.body, status=response.status) - return Response(status=201) + return Response(status=HTTPStatus.OK) APP = web.Application(middlewares=[aiohttp_error_middleware]) diff --git a/samples/python/58.teams-start-thread-in-channel/app.py b/samples/python/58.teams-start-thread-in-channel/app.py index 49fd4205bb..2a1cc4bfe0 100644 --- a/samples/python/58.teams-start-thread-in-channel/app.py +++ b/samples/python/58.teams-start-thread-in-channel/app.py @@ -5,6 +5,7 @@ import traceback import uuid from datetime import datetime +from http import HTTPStatus from aiohttp import web from aiohttp.web import Request, Response, json_response @@ -72,7 +73,7 @@ async def messages(req: Request) -> Response: if "application/json" in req.headers["Content-Type"]: body = await req.json() else: - return Response(status=415) + return Response(status=HTTPStatus.UNSUPPORTED_MEDIA_TYPE) activity = Activity().deserialize(body) auth_header = req.headers["Authorization"] if "Authorization" in req.headers else "" @@ -80,7 +81,7 @@ async def messages(req: Request) -> Response: response = await ADAPTER.process_activity(activity, auth_header, BOT.on_turn) if response: return json_response(data=response.body, status=response.status) - return Response(status=201) + return Response(status=HTTPStatus.OK) APP = web.Application(middlewares=[aiohttp_error_middleware])