ProfileFilter#
- class teamworksams.export_filter.ProfileFilter(user_key: str | None = None, user_value: str | List[str] | None = None)[source]#
Bases:
object
Filter for selecting users in profile data export.
Defines criteria for filtering profiles retrieved by
get_profile_data()
, allowing selection based on user attributes (e.g., username, group). Validates filter parameters for compatibility with the AMS API.- Parameters:
user_key (Optional[str]) – The user attribute to filter by, one of ‘group’, ‘username’, ‘email’, or ‘about’. If None, no filtering is applied. Defaults to None.
user_value (Optional[Union[str, List[str]]]) – The value(s) to filter by, such as a username, email, or group name. Can be a single string or a list of strings. If None, no filtering is applied. Defaults to None.
- user_key#
The filter key.
- Type:
Optional[str]
- user_value#
The filter value(s).
- Type:
Optional[Union[str, List[str]]]
- Raises:
ValueError – If user_key is not one of the valid options (‘group’, ‘username’, ‘email’, ‘about’).
Examples
>>> from teamworksams import ProfileFilter, get_profile_data >>> filter = ProfileFilter(user_key = "group", user_value = "Group A") >>> df = get_profile_data( ... form = "Athlete Profile", ... url = "https://example.smartabase.com/site", ... filter = filter ... )
Additional Notes#
The
user_key
must be one of ‘username’, ‘email’, ‘group’, or ‘about’;user_value
is case-sensitive and supports lists (e.g., [‘TeamA’]).Use with get_profile_data() to limit profiles to specific users, reducing API load for large datasets.
See Also#
get_profile_data(): Function using
ProfileFilter
.ProfileOption
: Configuration options for profile retrieval.