cyberjunky / python-garminconnect

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

get_activities() not found #201

Open chris-brown-nz opened 2 months ago

chris-brown-nz commented 2 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 2 months ago

Try changing to .get_activities_by_date(start_date, end_date)

chris-brown-nz commented 2 months ago

.get_activities_by_date(start_date, end_date) works, thanks

darroni commented 2 months ago

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