Add plan_tour() for creating planned tours - #29
Open
sebastianzabel wants to merge 3 commits into
Open
Conversation
…g API Currently, kompy can only upload recorded tours via upload_tour(). This adds support for creating planned tours using the same routing engine as Komoot's web-based route planner. The new plan_tour() method: - Takes a list of waypoints and routes between them using Komoot's routing API - Saves the result as a planned tour (tour_planned), not a recorded tour - Returns tour_id, URL, distance, and duration - Supports sport type, fitness level (constitution), date, and privacy settings Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The routing endpoint only exists on www.komoot.com/api, but the save endpoint works on api.komoot.de/v007/tours/ — consistent with all other endpoints in the library. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Add sport type validation against SupportedActivities - List common sport types in docstring (racebike, touringbicycle, mtb, hike, jogging, mtb_easy) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Author
|
@Tsadoq would be nice if you can approve my pr :-) |
Tsadoq
self-requested a review
May 13, 2026 07:34
Tsadoq
approved these changes
May 13, 2026
Owner
Sorry for delay, approved |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
plan_tour()method toKomootConnectorthat creates planned tours (not recorded tours)/api/routing/tour, then save via/api/v007/tours/astour_plannedMotivation
Currently
upload_tour()can only create recorded tours from GPX/FIT files. There is no way to programmatically create a planned tour — the kind you'd create in Komoot's web route planner. This is useful for automated route planning, batch tour creation, and integration with external tools.Usage
Parameters
waypointsList[Dict]{"lat": float, "lng": float}dicts (min. 2)tour_namestrsportstr"racebike"SupportedActivitiesvalue)constitutionint3datestrstatusstr"friends"Returns
{ "tour_id": 123456, "url": "https://www.komoot.com/tour/123456", "distance": 29.6, # km "duration": 77, # minutes "type": "tour_planned", "name": "Weekend Loop", }Test plan
🤖 Generated with Claude Code