-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathexample.py
More file actions
43 lines (30 loc) · 1.14 KB
/
Copy pathexample.py
File metadata and controls
43 lines (30 loc) · 1.14 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue Aug 2 16:23:42 2022
@author: Nishad Mandlik
"""
from getpass import getpass
from komPYoot import API, TourType, TourStatus, Sport, TourOwner
_DOWNLOAD_DIR = "./"
def main():
print("Please enter your Komoot account credentials.")
email_id = input("Email ID: ")
password = getpass("Password (hidden input): ")
a = API()
a.login(email_id, password)
# Get list of tours with the given filters
tours = a.get_user_tours_list(tour_type=TourType.PLANNED,
tour_status=TourStatus.PUBLIC,
sport=Sport.BIKE_TOURING,
tour_owner=TourOwner.SELF)
# Get the ID of the first tour in the list
tour_id = tours[0]["id"]
# Download the tour to the specified directory
file_name = a.download_tour_gpx_file(tour_id, _DOWNLOAD_DIR)
# Upload the downloaded tour as an recorded activity
a.upload_tour_gpx(Sport.BIKE_TOURING, _DOWNLOAD_DIR + "/" + file_name,
duration=None)
return tours
if __name__ == '__main__':
tours = main()