Welcome to komPYoot’s documentation!
komPYoot package
komPYoot.api
Created on Tue Aug 2 12:51:22 2022.
@author: Nishad Mandlik
- class API[source]
Bases:
object
Class for interfacing with the Komoot API.
Refer to https://static.komoot.de/doc/external-api/v007/index.html
- download_tour_gpx(tour_id, download_dir)[source]
Download tour in the GPX format.
- Parameters
tour_id (str) – Tour ID.
download_dir (str) – Path of the directory where the downloaded tour will be saved.
- Raises
RuntimeError – If no user is logged-in.
- Returns
file_name if download is successful, None otherwise.
- Return type
str or None
- get_user_disp_name()[source]
Return the display name of the logged-in user.
- Raises
RuntimeError – If no user is logged-in.
- Return type
str.
- get_user_email()[source]
Return the email ID of the logged-in user.
- Raises
RuntimeError – If no user is logged-in.
- Return type
str.
- get_user_id()[source]
Return the user ID of the logged-in user.
- Raises
RuntimeError – If no user is logged-in.
- Return type
str.
- get_user_pic_url()[source]
Return the display picture URL of the logged-in user. If picture is not set, None is returned.
- Raises
RuntimeError – If no user is logged-in.
- Return type
str or None.
- get_user_tours_list(tour_type=None, tour_status=None, sport=None, tour_owner=None)[source]
Get the list of tours for the logged-in user, according to the user-defined filters.
- Parameters
tour_type (TourType or None, optional) – Bitwise OR-ed flags for filtering multiple tour types. The default is None.
tour_status (TourStatus or None, optional) – Bitwise OR-ed flags for filtering multiple tour statuses. The default is None.
sport (Sport or None, optional) – Bitwise OR-ed flags for filtering multiple sports. The default is None.
tour_owner (TourOwner or None, optional) – Bitwise OR-ed flags for filtering activities according to creator (self or others). The default is None.
- Raises
RuntimeError – If no user is logged-in.
- Returns
tours – List of dictionaries containing details of tours.
- Return type
list
- login(email_id, password)[source]
Authenticate user credentials and generate access token for the Komoot API.
- Parameters
email_id (str) – Email ID for Komoot account.
password (str) – Password for Komoot account.
- Returns
True if login is successful, False otherwise.
- Return type
bool
- upload_tour_gpx(sport, file_path, duration=None)[source]
Upload a GPX file as a recorded activity.
- Parameters
sport (Sport) – Type of sport for the tour.
file_path (str) – Path of the GPX file.
duration (int or None, optional) – Time in motion (in seconds) for the tour. If None, Komoot assumes the duration of the entire tour to be the time in motion. The default is None.
- Raises
RuntimeError – If no user is logged-in.
- Returns
True, if upload is successful, False otherwise.
- Return type
bool
- class Sport(value)[source]
Bases:
AutoFlag
Flag Enum for Sports.
Obtained from https://static.komoot.de/doc/external-api/v007/sports.html
ReadMe
Python Interface for Komoot API