From 26a7f15eed22452d647041d163c894f4a54c0b19 Mon Sep 17 00:00:00 2001 From: Charles Lowell Date: Tue, 16 Jul 2019 15:11:59 -0700 Subject: [PATCH] Avoid surprising aiohttp with unexpected kwargs (#6355) --- .../azure/core/pipeline/transport/aiohttp.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/sdk/core/azure-core/azure/core/pipeline/transport/aiohttp.py b/sdk/core/azure-core/azure/core/pipeline/transport/aiohttp.py index c9a425474567f..ceec93dd3d841 100644 --- a/sdk/core/azure-core/azure/core/pipeline/transport/aiohttp.py +++ b/sdk/core/azure-core/azure/core/pipeline/transport/aiohttp.py @@ -97,9 +97,7 @@ async def close(self): self._session_owner = False self.session = None - def _build_ssl_config(self, **config): - verify = config.get('connection_verify', self.config.connection.verify) - cert = config.get('connection_cert', self.config.connection.cert) + def _build_ssl_config(self, cert, verify): ssl_ctx = None if cert or verify not in (True, False): @@ -144,7 +142,10 @@ async def send(self, request: HttpRequest, **config: Any) -> Optional[AsyncHttpR await self.open() error = None response = None - config['ssl'] = self._build_ssl_config(**config) + config['ssl'] = self._build_ssl_config( + cert=config.pop('connection_cert', self.config.connection.cert), + verify=config.pop('connection_verify', self.config.connection.verify) + ) try: stream_response = config.pop("stream", False) result = await self.session.request( @@ -152,7 +153,7 @@ async def send(self, request: HttpRequest, **config: Any) -> Optional[AsyncHttpR request.url, headers=request.headers, data=self._get_request_data(request), - timeout=config.get('connection_timeout', self.config.connection.timeout), + timeout=config.pop('connection_timeout', self.config.connection.timeout), allow_redirects=False, **config )