Use aiohttp session for docker queries

This commit is contained in:
Julien Duponchelle committed 2017-03-20 19:46:50 +01:00
1 parent 55563b9808
commit a571b1a2f8
2 files changed
+6 -4

No files matched your search

+3 -1
View File
@@ -107,7 +107,8 @@ class Docker(BaseManager):
data = json.dumps(data)
url = "http://docker/" + path
try:
response = yield from aiohttp.request(
session = aiohttp.ClientSession()
response = yield from session.request(
method,
url,
connector=(yield from self.connector()),
@@ -116,6 +117,7 @@ class Docker(BaseManager):
headers={"content-type": "application/json", },
timeout=timeout
)
yield from session.close()
except (aiohttp.ClientResponseError, aiohttp.ClientOSError) as e:
raise DockerError("Docker has returned an error: {}".format(str(e)))
if response.status >= 300: