diff --git a/homeassistant/components/lastfm/config_flow.py b/homeassistant/components/lastfm/config_flow.py index f7d7a9fd314..3f00443147d 100644 --- a/homeassistant/components/lastfm/config_flow.py +++ b/homeassistant/components/lastfm/config_flow.py @@ -128,9 +128,12 @@ class LastFmConfigFlowHandler(ConfigFlow, domain=DOMAIN): main_user, _ = get_lastfm_user( self.data[CONF_API_KEY], self.data[CONF_MAIN_USER] ) + friends_response = await self.hass.async_add_executor_job( + main_user.get_friends + ) friends = [ SelectOptionDict(value=friend.name, label=friend.get_name(True)) - for friend in main_user.get_friends() + for friend in friends_response ] except WSError: friends = [] @@ -197,9 +200,12 @@ class LastFmOptionsFlowHandler(OptionsFlowWithConfigEntry): self.options[CONF_API_KEY], self.options[CONF_MAIN_USER], ) + friends_response = await self.hass.async_add_executor_job( + main_user.get_friends + ) friends = [ SelectOptionDict(value=friend.name, label=friend.get_name(True)) - for friend in main_user.get_friends() + for friend in friends_response ] except WSError: friends = []