* Upgrade aiohttp2

* Fix resource caching

* Fix helpers.aiohttp_client

* Lint

* Use static path for api error_log

* Fix ClientErrors import

* Remove not needed DisconnectError

* Remove releasing responses code

* Add timeout if stream starts non responding

* More async_aiohttp_proxy_stream cleanup

* Fix references to ClientError

* Fix fingerprinting

* Fix aiohttp stream tests

* Rename aiohttp_proxy_stream

* Remove impossible darksky test

* Fix sleepiq requests escaping mocker

* Lint

* Remove deprecated parameter

* Break up aiohttp_proxy_stream in 2 methods

* Lint

* Upgrade to aiohttp 2.0.4

* Convert connector close to a callback

* Fix static fingerprinted links
This commit is contained in:
Paulus Schoutsen 2017-03-30 00:50:53 -07:00 committed by GitHub
parent 7b83a836f3
commit 714b516176
36 changed files with 250 additions and 442 deletions

View file

@ -81,7 +81,6 @@ def async_setup(hass, config):
template_payload.async_render(variables=service.data),
'utf-8')
request = None
try:
with async_timeout.timeout(timeout, loop=hass.loop):
request = yield from getattr(websession, method)(
@ -90,22 +89,18 @@ def async_setup(hass, config):
auth=auth
)
if request.status < 400:
_LOGGER.info("Success call %s.", request.url)
return
if request.status < 400:
_LOGGER.info("Success call %s.", request.url)
else:
_LOGGER.warning(
"Error %d on call %s.", request.status, request.url)
except asyncio.TimeoutError:
_LOGGER.warning("Timeout call %s.", request.url)
except aiohttp.errors.ClientError:
except aiohttp.ClientError:
_LOGGER.error("Client error %s.", request.url)
finally:
if request is not None:
yield from request.release()
# register services
hass.services.async_register(DOMAIN, name, async_service_handler)