Skip to content

Commit 6050589

Browse files
committed
Fix compatability with aiohttp>=3
aiohttp.Timeout is no longer available
1 parent e4a12d8 commit 6050589

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

src/zeep/asyncio/transport.py

+5-4
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,7 @@ def _load_remote_data(self, url):
4747

4848
async def _load_remote_data_async():
4949
nonlocal result
50-
with aiohttp.Timeout(self.load_timeout):
51-
response = await self.session.get(url)
50+
async with self.session.get(url, timeout=self.load_timeout) as response:
5251
result = await response.read()
5352
try:
5453
response.raise_for_status()
@@ -65,7 +64,8 @@ async def _load_remote_data_async():
6564

6665
async def post(self, address, message, headers):
6766
self.logger.debug("HTTP Post to %s:\n%s", address, message)
68-
with aiohttp.Timeout(self.operation_timeout):
67+
async with self.session.post(address, data=message, headers=headers,
68+
timeout=self.operation_timeout):
6969
response = await self.session.post(
7070
address, data=message, headers=headers)
7171
self.logger.debug(
@@ -79,7 +79,8 @@ async def post_xml(self, address, envelope, headers):
7979
return await self.new_response(response)
8080

8181
async def get(self, address, params, headers):
82-
with aiohttp.Timeout(self.operation_timeout):
82+
async with self.session.get(address, params=params, headers=headers,
83+
timeout=self.operation_timeout):
8384
response = await self.session.get(
8485
address, params=params, headers=headers)
8586

0 commit comments

Comments
 (0)