"""Logic related to the various social platforms.""" from oto import response from social_analytics.logic import instagram_collector from social_analytics.logic import spotify_collector def get_instagram_user(platform_id): """Get Instagram user details. Args: platform_id (string): the Instagram ID of the user. Returns: response.Response: containing the user details. """ user = instagram_collector.collect_instagram_metrics( platform_id, instagram_collector.refresh_token()) if not user: return response.create_not_found_response() return response.Response(user) def get_spotify_user(platform_id): """Get Spotify user details. Args: platform_id (string): the Spotify ID of the user. Returns: response.Response: containing the user details. """ user = spotify_collector.collect_spotify_metrics( platform_id, spotify_collector.refresh_token()['access_token']) if not user: return response.create_not_found_response() return response.Response(user)