8000 Merge branch 'main' into releases/4.14 · DEXTERBP/botbuilder-python@f3e1228 · GitHub
[go: up one dir, main page]

Skip to content

Commit f3e1228

Browse files
author
Tracy Boehrer
committed
Merge branch 'main' into releases/4.14
2 parents 5cb6949 + 489d547 commit f3e1228

File tree

13 files changed

+1123
-419
lines changed

13 files changed

+1123
-419
lines changed

.pylintrc

Lines changed: 503 additions & 405 deletions
Large diffs are not rendered by default.

libraries/botbuilder-applicationinsights/django_tests/tests.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,9 @@ def test_logger(self):
195195
)
196196

197197
def test_thrower(self):
198-
"""Tests that unhandled exceptions generate an exception telemetry item parented to the request telemetry item"""
198+
"""
199+
Tests that unhandled exceptions generate an exception telemetry item parented to the request telemetry item
200+
"""
199201
response = self.invoke_post("thrower")
200202
self.assertEqual(response.status_code, 500)
201203

libraries/botbuilder-core/botbuilder/core/cloud_adapter_base.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ async def send_activities(
100100
)
101101
)
102102

103-
response = response or ResourceResponse(activity.id or "")
103+
response = response or ResourceResponse(id=activity.id or "")
104104

105105
responses.append(response)
106106

libraries/botbuilder-core/botbuilder/core/integration/aiohttp_channel_service_exception_middleware.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66
from aiohttp.web import (
77
middleware,
8+
HTTPException,
89
HTTPNotImplemented,
910
HTTPUnauthorized,
1011
HTTPNotFound,
@@ -27,6 +28,8 @@ async def aiohttp_error_middleware(request, handler):
2728
raise HTTPUnauthorized()
2829
except KeyError:
2930
raise HTTPNotFound()
31+
except HTTPException:
32+
raise
3033
except Exception:
3134
traceback.print_exc()
3235
raise HTTPInternalServerError()

libraries/botbuilder-core/botbuilder/core/teams/teams_info.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
teams_get_meeting_info,
1111
teams_get_channel_data,
1212
)
13-
from botbuilder.core import CloudAdapterBase, BotFrameworkAdapter, TurnContext
13+
from botbuilder.core import CloudAdapterBase, BotFrameworkAdapter, TurnContext, BotAdapter
1414
from botbuilder.schema import Activity, ConversationParameters, ConversationReference
1515
from botbuilder.schema.teams import (
1616
ChannelInfo,
@@ -318,10 +318,15 @@ def get_team_id(turn_context: TurnContext):
318318

319319
@staticmethod
320320
async def _get_connector_client(turn_context: TurnContext) -> ConnectorClient:
321-
return await turn_context.adapter.create_connector_client(
322-
turn_context.activity.service_url
321+
connector_client = turn_context.turn_state.get(
322+
BotAdapter.BOT_CONNECTOR_CLIENT_KEY
323323
)
324324

325+
if connector_client is None:
326+
raise ValueError('This method requires a connector client.')
327+
328+
return connector_client
329+
325330
@staticmethod
326331
async def _get_members(
327332
connector_client: ConnectorClient, conversation_id: str

libraries/botbuilder-core/tests/simple_adapter.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ async def update_activity(self, context: TurnContext, activity: Activity):
7575
if self._call_on_update is not None:
7676
self._call_on_update(activity)
7777

78-
return ResourceResponse(activity.id)
78+
return ResourceResponse(id=activity.id)
7979

8080
async def process_request(self, activity, handler):
8181
context = TurnContext(self, activity)

libraries/botbuilder-core/tests/teams/simple_adapter_with_create_conversation.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ async def update_activity(self, context: TurnContext, activity: Activity):
7676
if self._call_on_update is not None:
7777
self._call_on_update(activity)
7878

79-
return ResourceResponse(activity.id)
79+
return ResourceResponse(id=activity.id)
8080

8181
async def process_request(self, activity, handler):
8282
context = TurnContext(self, activity)

libraries/botbuilder-core/tests/teams/test_teams_activity_handler.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -592,6 +592,9 @@ async def test_on_teams_members_added_activity(self):
592592

593593
turn_context = TurnContext(SimpleAdapter(), activity)
594594

595+
mock_connector_client = await SimpleAdapter.create_connector_client(self, turn_context.activity.service_url)
596+
turn_context.turn_state[BotAdapter.BOT_CONNECTOR_CLIENT_KEY] = mock_connector_client
597+
595598
# Act
596599
bot = TestingTeamsActivityHandler()
597600
await bot.on_turn(turn_context)

libraries/botbuilder-integration-aiohttp/botbuilder/integration/aiohttp/streaming/aiohttp_web_socket.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ def __init__(
2929

3030
def dispose(self):
3131
if self._session:
32-
asyncio.create_task(self._session.close())
32+
task = asyncio.create_task(self._session.close())
3333

3434
async def close(self, close_status: WebSocketCloseStatus, status_description: str):
3535
await self._aiohttp_ws.close(

libraries/botbuilder-integration-applicationinsights-aiohttp/botbuilder/integration/applicationinsights/aiohttp/aiohttp_telemetry_middleware.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ def retrieve_aiohttp_body():
1919
@middleware
2020
async def bot_telemetry_middleware(request, handler):
2121
"""Process the incoming Flask request."""
22-
if "application/json" in request.headers["Content-Type"]:
22+
if "Content-Type" in request.headers and request.headers["Content-Type"] == "application/json":
2323
body = await request.json()
2424
_REQUEST_BODIES[current_thread().ident] = body
2525

libraries/botframework-streaming/botframework/streaming/protocol_adapter.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ async def _on_receive_response(self, identifier: UUID, response: ReceiveResponse
7575

7676
def _on_cancel_stream(self, content_stream_assembler: PayloadStreamAssembler):
7777
# TODO: on original C# code content_stream_assembler is typed as IAssembler
78-
asyncio.create_task(
78+
task = asyncio.create_task(
7979
self._send_operations.send_cancel_stream(
8080
content_stream_assembler.identifier
8181
)

0 commit comments

Comments
 (0)
0