"""Interface for the split.io SDK""" from features.connectors import split def get_split_feature(traffic_type, split_name, attributes): """Get active variant for split (feature) Args: traffic_type(str): identifier type for any hierarchy of users split_name(str): feature name attributes(dict): parameter to filter features based on split rules eg: {'user_id': 'oa:562'}, {'user_id': 'alw:46997'}, {'vendor_id': 23904}, {'identity_id': '5c548bd462501638ea3ed444'} Returns: Response: active variant eg: on, off, control(incase of error) """ return split.get_split_client().get_treatment(traffic_type, split_name, attributes) def get_all_split_features(traffic_type, attributes): """Get active variant for all splits (features) Args: traffic_type(str): identifier type for any hierarchy of users attributes(dict): parameter to filter features based on split rules eg: {'user_id': 'oa:562'}, {'user_id': 'alw:46997'}, {'vendor_id': 23904}, {'identity_id': '5c548bd462501638ea3ed444'} Returns: Response(dict): dict of feature_name:active_variant eg: { "mobile_artist_profile_recent_products_tab": "control", "profile_header_product_search": "control", "mobile_artist_product_access": "enabled" } """ return split.get_split_client().get_treatments( traffic_type, split.get_split_manager().split_names(), attributes )