mirror of
https://github.com/home-assistant/core.git
synced 2025-07-21 04:07:08 +00:00
Retrieve friends in an async manner in Lastfm (#94255)
This commit is contained in:
parent
77badafea1
commit
425c964898
@ -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 = []
|
||||
|
Loading…
x
Reference in New Issue
Block a user