sweatstack 0.48.0__py3-none-any.whl → 0.50.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
sweatstack/client.py CHANGED
@@ -692,12 +692,13 @@ class Client(OAuth2Mixin, DelegationMixin, TokenStorageMixin, LocalCacheMixin):
692
692
  sports: list[Sport | str] | None = None,
693
693
  tags: list[str] | None = None,
694
694
  limit: int = 100,
695
+ offset: int = 0,
695
696
  ) -> Generator[ActivitySummary, None, None]:
696
697
  num_returned = 0
697
698
  default_limit = 100
698
699
  params = {
699
700
  "limit": default_limit,
700
- "offset": 0,
701
+ "offset": offset,
701
702
  }
702
703
  if start is not None:
703
704
  params["start"] = start.isoformat()
@@ -742,6 +743,7 @@ class Client(OAuth2Mixin, DelegationMixin, TokenStorageMixin, LocalCacheMixin):
742
743
  sports: list[Sport | str] | None = None,
743
744
  tags: list[str] | None = None,
744
745
  limit: int = 100,
746
+ offset: int = 0,
745
747
  as_dataframe: bool = False,
746
748
  ) -> list[ActivitySummary] | pd.DataFrame:
747
749
  """Gets a list of activities based on specified filters.
@@ -752,6 +754,7 @@ class Client(OAuth2Mixin, DelegationMixin, TokenStorageMixin, LocalCacheMixin):
752
754
  sports: Optional list of sports to filter activities by. Can be Sport objects or string IDs.
753
755
  tags: Optional list of tags to filter activities by.
754
756
  limit: Maximum number of activities to return. Defaults to 100.
757
+ offset: Number of activities to skip. Defaults to 0.
755
758
  as_dataframe: Whether to return results as a pandas DataFrame. Defaults to False.
756
759
 
757
760
  Returns:
@@ -767,6 +770,7 @@ class Client(OAuth2Mixin, DelegationMixin, TokenStorageMixin, LocalCacheMixin):
767
770
  sports=sports,
768
771
  tags=tags,
769
772
  limit=limit,
773
+ offset=offset,
770
774
  ))
771
775
  if as_dataframe:
772
776
  df = pd.DataFrame([activity.model_dump() for activity in activities])
@@ -829,6 +833,7 @@ class Client(OAuth2Mixin, DelegationMixin, TokenStorageMixin, LocalCacheMixin):
829
833
  self,
830
834
  activity_id: str,
831
835
  adaptive_sampling_on: Literal["power", "speed"] | None = None,
836
+ metrics: list[Metric | str] | None = None,
832
837
  ) -> pd.DataFrame:
833
838
  """Gets the raw data for a specific activity.
834
839
 
@@ -839,6 +844,7 @@ class Client(OAuth2Mixin, DelegationMixin, TokenStorageMixin, LocalCacheMixin):
839
844
  activity_id: The unique identifier of the activity.
840
845
  adaptive_sampling_on: Optional parameter to apply adaptive sampling on
841
846
  either "power" or "speed" data. If None, no adaptive sampling is applied.
847
+ metrics: Optional list of metrics to include in the results. Can be a list of Metric enums or strings.
842
848
 
843
849
  Returns:
844
850
  pd.DataFrame: A pandas DataFrame containing the activity's time-series data.
@@ -849,6 +855,8 @@ class Client(OAuth2Mixin, DelegationMixin, TokenStorageMixin, LocalCacheMixin):
849
855
  params = {}
850
856
  if adaptive_sampling_on is not None:
851
857
  params["adaptive_sampling_on"] = adaptive_sampling_on
858
+ if metrics is not None:
859
+ params["metrics"] = self._enums_to_strings(metrics)
852
860
 
853
861
  with self._http_client() as client:
854
862
  response = client.get(
@@ -900,6 +908,7 @@ class Client(OAuth2Mixin, DelegationMixin, TokenStorageMixin, LocalCacheMixin):
900
908
  self,
901
909
  sport: Sport | str | None = None,
902
910
  adaptive_sampling_on: Literal["power", "speed"] | None = None,
911
+ metrics: list[Metric | str] | None = None,
903
912
  ) -> pd.DataFrame:
904
913
  """Gets the data for the latest activity of a specific sport.
905
914
 
@@ -910,6 +919,7 @@ class Client(OAuth2Mixin, DelegationMixin, TokenStorageMixin, LocalCacheMixin):
910
919
  sport: Optional sport to filter by. Can be a Sport enum or string.
911
920
  adaptive_sampling_on: Optional metric to apply adaptive sampling for visualization.
912
921
  Can be either "power" or "speed". Defaults to None.
922
+ metrics: Optional list of metrics to include in the results. Can be a list of Metric enums or strings.
913
923
 
914
924
  Returns:
915
925
  pd.DataFrame: A pandas DataFrame containing the activity data.
@@ -918,7 +928,7 @@ class Client(OAuth2Mixin, DelegationMixin, TokenStorageMixin, LocalCacheMixin):
918
928
  HTTPStatusError: If the API request fails.
919
929
  """
920
930
  activity = self.get_latest_activity(sport=sport)
921
- return self.get_activity_data(activity.id, adaptive_sampling_on)
931
+ return self.get_activity_data(activity.id, adaptive_sampling_on, metrics=metrics)
922
932
 
923
933
  def get_latest_activity_mean_max(
924
934
  self,
@@ -1075,12 +1085,13 @@ class Client(OAuth2Mixin, DelegationMixin, TokenStorageMixin, LocalCacheMixin):
1075
1085
  sports: list[Sport | str] | None = None,
1076
1086
  tags: list[str] | None = None,
1077
1087
  limit: int = 100,
1088
+ offset: int = 0,
1078
1089
  ) -> Generator[TraceDetails, None, None]:
1079
1090
  num_returned = 0
1080
1091
  default_limit = 100
1081
1092
  params = {
1082
1093
  "limit": default_limit,
1083
- "offset": 0,
1094
+ "offset": offset,
1084
1095
  }
1085
1096
  if start is not None:
1086
1097
  params["start"] = start.isoformat()
@@ -1148,6 +1159,7 @@ class Client(OAuth2Mixin, DelegationMixin, TokenStorageMixin, LocalCacheMixin):
1148
1159
  sports: list[Sport | str] | None = None,
1149
1160
  tags: list[str] | None = None,
1150
1161
  limit: int = 100,
1162
+ offset: int = 0,
1151
1163
  as_dataframe: bool = False,
1152
1164
  ) -> list[TraceDetails] | pd.DataFrame:
1153
1165
  """Gets a list of traces based on specified filters.
@@ -1158,6 +1170,7 @@ class Client(OAuth2Mixin, DelegationMixin, TokenStorageMixin, LocalCacheMixin):
1158
1170
  sports: Optional list of sports to filter traces by. Can be Sport objects or string IDs.
1159
1171
  tags: Optional list of tags to filter traces by.
1160
1172
  limit: Maximum number of traces to return. Defaults to 100.
1173
+ offset: Number of traces to skip. Defaults to 0.
1161
1174
  as_dataframe: Whether to return results as a pandas DataFrame. Defaults to False.
1162
1175
 
1163
1176
  Returns:
@@ -1173,6 +1186,7 @@ class Client(OAuth2Mixin, DelegationMixin, TokenStorageMixin, LocalCacheMixin):
1173
1186
  sports=sports,
1174
1187
  tags=tags,
1175
1188
  limit=limit,
1189
+ offset=offset,
1176
1190
  ))
1177
1191
  if not as_dataframe:
1178
1192
  return traces
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: sweatstack
3
- Version: 0.48.0
3
+ Version: 0.50.0
4
4
  Summary: The official Python client for SweatStack
5
5
  Author-email: Aart Goossens <aart@gssns.io>
6
6
  Requires-Python: >=3.9
@@ -1,6 +1,6 @@
1
1
  sweatstack/__init__.py,sha256=tiVfgKlswRPaDMEy0gA7u8rveqEYZTA_kyB9lJ3J6Sc,21
2
2
  sweatstack/cli.py,sha256=N1NWOgEZR2yaJvIXxo9qvp_jFlypZYb0nujpbVNYQ6A,720
3
- sweatstack/client.py,sha256=389f_XghylIeN-q4FPXFprYZ3Bje-b4d4Ko42bhzf5s,53950
3
+ sweatstack/client.py,sha256=oIp1aoQzVGcMyXYqJg_LNq3624DSIllAWhi_g1iRJWs,54685
4
4
  sweatstack/constants.py,sha256=fGO6ksOv5HeISv9lHRoYm4besW1GTveXS8YD3K0ljg0,41
5
5
  sweatstack/ipython_init.py,sha256=OtBB9dQvyLXklD4kA2x1swaVtU9u73fG4V4-zz4YRAg,139
6
6
  sweatstack/jupyterlab_oauth2_startup.py,sha256=YcjXvzeZ459vL_dCkFi1IxX_RNAu80ZX9rwa0OXJfTM,1023
@@ -11,7 +11,7 @@ sweatstack/streamlit.py,sha256=_PER03s0dYu5eF1MZdewPDqSvYHqMr0lZLu_EnGit3Y,13257
11
11
  sweatstack/sweatshell.py,sha256=MYLNcWbOdceqKJ3S0Pe8dwHXEeYsGJNjQoYUXpMTftA,333
12
12
  sweatstack/utils.py,sha256=AwHRdC1ziOZ5o9RBIB21Uxm-DoClVRAJSVvgsmSmvps,1801
13
13
  sweatstack/Sweat Stack examples/Getting started.ipynb,sha256=k2hiSffWecoQ0VxjdpDcgFzBXDQiYEebhnAYlu8cgX8,6335204
14
- sweatstack-0.48.0.dist-info/METADATA,sha256=HVIrAr7pmRHAVvSrmiV8hp8KN_BWSsSGc1Mrqr462js,852
15
- sweatstack-0.48.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
16
- sweatstack-0.48.0.dist-info/entry_points.txt,sha256=kCzOUQI3dqbTpEYqtgYDeiKFaqaA7BMlV6D24BMzCFU,208
17
- sweatstack-0.48.0.dist-info/RECORD,,
14
+ sweatstack-0.50.0.dist-info/METADATA,sha256=2U6hV_PT2DR5SPnJ8bdKlrIF7Iqded55SI6HOMdQ4x8,852
15
+ sweatstack-0.50.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
16
+ sweatstack-0.50.0.dist-info/entry_points.txt,sha256=kCzOUQI3dqbTpEYqtgYDeiKFaqaA7BMlV6D24BMzCFU,208
17
+ sweatstack-0.50.0.dist-info/RECORD,,