Skip to content

Commit bc606c5

Browse files
committed
Use async instead of a coroutine
1 parent e3a7bf7 commit bc606c5

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

netdata/__init__.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,19 +31,18 @@ def __init__(self, host, resource, loop, session, port='19999'):
3131
self.resource = resource
3232
self.values = None
3333

34-
@asyncio.coroutine
35-
def async_get_data(self):
34+
async def async_get_data(self):
3635
url = _RESOURCE.format(
3736
host=self.host, port=self.port, api=API_VERSION,
3837
resource=self.resource, realtime=_REALTIME)
3938

4039
try:
4140
with async_timeout.timeout(5, loop=self._loop):
42-
response = yield from self._session.get(url)
41+
response = await self._session.get(url)
4342

4443
_LOGGER.debug(
4544
"Response from Netdata: %s", response.status)
46-
data = yield from response.json()
45+
data = await response.json()
4746
_LOGGER.debug(data)
4847
self.values = {k: v for k, v in zip(
4948
data['labels'], data['data'][0])}

0 commit comments

Comments
 (0)