Holdsport¶
pyholdsport.Holdsport
¶
Class for interacting with Holdsport.
__init__(holdsport_username: str | None = None, holdsport_password: str | None = None) -> None
¶
Initialization of the Holdsport object.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
holdsport_username
|
str | None
|
The Holdsport login username. If not specified environment variable HOLDSPORT_USERNAME will be used. If neither are set, an exception will be raised. |
None
|
holdsport_password
|
str | None
|
The Holdsport login password. If not specified environment variable HOLDSPORT_PASSWORD will be used. If neither are set, an exception will be raised. |
None
|
get_teams() -> list[HoldsportTeam]
¶
Return a list of HoldsportTeam objects the user is member of.
Returns:
| Type | Description |
|---|---|
list[HoldsportTeam]
|
list[HoldsportTeam]: List of teams the user is member of. |
Raises:
| Type | Description |
|---|---|
HTTPStatusError
|
If the request fails. |
get_members(team_id: int) -> list[HoldsportMember]
¶
Return a list of HoldsportMember objects for the requested team.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
team_id
|
int
|
The id of the team. |
required |
Returns:
| Type | Description |
|---|---|
list[HoldsportMember]
|
list[HoldsportMember]: List of members in the requested team. |
Raises:
| Type | Description |
|---|---|
HTTPStatusError
|
If the request fails. |
get_member(team_id: int, member_id: int) -> HoldsportMember | None
¶
Return a HoldsportMember object for the requested team and member id.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
team_id
|
int
|
The id of the team. |
required |
member_id
|
int
|
The id of the member. |
required |
Returns:
| Type | Description |
|---|---|
HoldsportMember | None
|
HoldsportMember | None: The requested member, or None if the member is not found. |
Raises:
| Type | Description |
|---|---|
HTTPStatusError
|
If the request fails. |
get_activities(team_id: int, date: str | None = None, page: int = 1, per_page: int = 20) -> list[HoldsportActivity]
¶
Return a list of HoldsportActivity objects for the requested team.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
team_id
|
int
|
The id of the team. |
required |
date
|
str | None
|
The starting date to query activities from, in YYYY-MM-DD format. If not defined today is used. |
None
|
page
|
int
|
The page number to query. Defaults to 1. API default is 1. |
1
|
per_page
|
int
|
The number of activities to query. Defaults to 20. API default is 20, maximum is 100. |
20
|
Returns:
| Type | Description |
|---|---|
list[HoldsportActivity]
|
list[HoldsportActivity]: List of activities in the requested team. |
Raises:
| Type | Description |
|---|---|
HTTPStatusError
|
If the request fails. |
get_activity(team_id: int, activity_id: int) -> HoldsportActivity | None
¶
Return a HoldsportActivity object for the requested team and activity id.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
team_id
|
int
|
The id of the team. |
required |
activity_id
|
int
|
The id of the activity. |
required |
Returns:
| Type | Description |
|---|---|
HoldsportActivity | None
|
HoldsportActivity | None: The requested activity, or None if the activity is not found. |
Raises:
| Type | Description |
|---|---|
HTTPStatusError
|
If the request fails. |
get_activities_users(activity_id: int) -> list[HoldsportActivitiesUser]
¶
Return a list of HoldsportActivitiesUser objects for the requested activity.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
activity_id
|
int
|
The id of the activity. |
required |
Returns:
| Type | Description |
|---|---|
list[HoldsportActivitiesUser]
|
list[HoldsportActivitiesUser]: List of users in the requested activity. |
Raises:
| Type | Description |
|---|---|
HTTPStatusError
|
If the request fails. |