Giter VIP home page Giter VIP logo

medium_komoot's Introduction

Usage

python3 get_data.py

Dependencies

  • requests
  • json
  • math

All libraries are preinstalled with your Python version

Medium article

medium_komoot's People

Contributors

benmaier avatar simplylu avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

medium_komoot's Issues

License

Hey, thanks for this code! Could you add a License so it clears up reusability?

Komoot response structure has changed

the structure of komoot's response changed. Here's how to adapt the code:

tours = data["user"]["_embedded"]["tours"]["_embedded"]["items"]

for idx in range(len(tours)):
    print(f"({idx+1}) {tours[idx]['name']}")

tour_nr = int(input("Tour ID: "))
tour_url = tours[tour_nr-1]["_links"]["coordinates"]["href"]
response = s.get(tour_url, headers=headers)
tour_data = json.loads(response.text)

tour_data only contains coordinates now, so it probably will have to be merged with the data in tours[tour_nr-1] before a Tour object is created.

Use direct komoot API

Thanks for your article, helped me get started!

What I discovered is, that you can use https://api.komoot.de/v007/users/${clientId}/tours/, with email and password in basic authentication to directly get the komoot tours :)

add auth via keyring

Python provides a fancy module called keyring.
With that one can avoid saving his creds as plaintext in configs or code.
Could also be used for possible implementation of enhancement #1 if possibility of use is verified.
Will add that functionality as soon as I have some time for it.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.