No longer rely on requests (#23685)

* No longer rely on requests

* Lint

* Missed a few parts

* Fix types

* Fix more types

* Update __main__.py

* Fix tests

* Lint

* Fix script
This commit is contained in:
Paulus Schoutsen authored and GitHub committed 2019-05-08 11:15:04 -07:00
1 parent f019e2a204
commit cc13713abd
10 files changed
+271 -197

No files matched your search

+3 -1
View File
@@ -48,7 +48,9 @@ async def async_migrate_entry(hass, entry):
# Migrate Version 1 -> Version 2: New region codes.
if version == 1:
loc = await hass.async_add_executor_job(location.detect_location_info)
loc = await location.async_detect_location_info(
hass.helpers.aiohttp_client.async_get_clientsession()
)
if loc:
country = loc.country_name
if country in COUNTRIES:
+3 -2
View File
@@ -167,8 +167,9 @@ class PlayStation4FlowHandler(config_entries.ConfigFlow):
# Try to find region automatically.
if not self.location:
self.location = await self.hass.async_add_executor_job(
location.detect_location_info)
self.location = await location.async_detect_location_info(
self.hass.helpers.aiohttp_client.async_get_clientsession()
)
if self.location:
country = self.location.country_name
if country in COUNTRIES: