def get_stations():
"""
:returns list of all the(available) radio stations fetching from a server
helps to manage station list in one place
"""
stations_json = []
try:
print("Fetching stations data from server.")
response = requests.get(STATION_FETCH_URL)
stations_json = response.json()
except Exception as e:
logging.warn('Unable to load data from server. Processing local data.')
stations_json = get_stations_from_json()
finally:
return _format_station_json_to_dict(stations_json)
评论列表
文章目录