cyberjunky / python-garminconnect

Python 3 API wrapper for Garmin Connect to get activity statistics
MIT License
963 stars 149 forks source link

get_activities() not found #201

Closed chris-brown-nz closed 1 week ago

chris-brown-nz commented 7 months ago

Hi, I'm getting an error running the following:

gc.get_activities(start_date, 10)

This is the output:

HTTPError                                 Traceback (most recent call last)
[/usr/local/lib/python3.10/dist-packages/garth/http.py](https://localhost:8080/#) in request(self, method, subdomain, path, api, referrer, headers, **kwargs)
    138         try:
--> 139             self.last_resp.raise_for_status()
    140         except HTTPError as e:

5 frames
HTTPError: 404 Client Error: Not Found for url: https://connectapi.garmin.com/activitylist-service/activities/search/activities?start=2024-04-22&limit=10

During handling of the above exception, another exception occurred:

GarthHTTPError                            Traceback (most recent call last)
[/usr/local/lib/python3.10/dist-packages/garth/http.py](https://localhost:8080/#) in request(self, method, subdomain, path, api, referrer, headers, **kwargs)
    139             self.last_resp.raise_for_status()
    140         except HTTPError as e:
--> 141             raise GarthHTTPError(
    142                 msg="Error in request",
    143                 error=e,

GarthHTTPError: Error in request: 404 Client Error: Not Found for url: https://connectapi.garmin.com/activitylist-service/activities/search/activities?start=2024-04-22&limit=10

I am happy to have a look into this but can't find any documentation for the connect api - can you point me to it please?

darroni commented 7 months ago

Try changing to .get_activities_by_date(start_date, end_date)

chris-brown-nz commented 7 months ago

.get_activities_by_date(start_date, end_date) works, thanks

darroni commented 7 months ago

I don't think the get_activities method supports the datetime format. Maybe someone else can confirm.

psdupvi commented 1 month ago

Circling back on this super old issue, yeah -- the Garmin get activities request (which populates the Activity list page) has the format activitylist-service/activities/search/activities?limit=20&start=0 by default. So start is just an offset from the most recent activity

image

cyberjunky commented 1 week ago

Closing, as now more clearly hint typed in method.