"""Interface for the split.io SDK.""" from pythonfeatures.connectors.split import split_client from pythonfeatures.connectors.split import split_manager def get_single_feature(traffic_type, feature_name, attributes): """Get active variant for split (feature). Args: traffic_type(str): identifier type for any hierarchy of users feature_name(str): the name of the feature 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_client.get_treatment( traffic_type, feature_name, attributes) def get_all_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_client.get_treatments( traffic_type, split_manager.split_names(), attributes)