GithubHelp home page GithubHelp logo

plugarut / rest-api Goto Github PK

View Code? Open in Web Editor NEW

This project forked from roataway/rest-api

0.0 1.0 0.0 34 KB

Basic REST API for retrieving last known locations of trolleybuses and ETAs for a particular station.

License: GNU Affero General Public License v3.0

Makefile 4.16% Python 95.84%

rest-api's Introduction

Descriere generală

Acest mini web-server oferă informație despre starea troleibuzelor și a timpului de așteptare în stații, printr-un REST API. Actualizarea datelor se face prin MQTT.

Utilitatea acestuia constă în:

  • Obținerea unor date istorice despre poziția troleibuzelor, astfel încât https://github.com/roataway/web-ui să poată afișa ceva chiar din momentul în care pagina a fost deschisă (altfel trebuie să aștepți până când vin careva date prin websocket, pentru a desena ”coada” din spatele troleului).
  • Integrarea cu sisteme terțe, pentru care există doar opțiunea HTTP, de exemplu https://github.com/roataway/voice-robot.

API'ul propriu-zis

  • tracker/<tracker_id> - returnează un JSON cu ultima informație cunoscută despre tracker_id. Dacă parametrul tracker_id e absent, va returna un JSON cu toate trackerele cunoscute.

TODO

  • station/<station_id> - returnează lista timpului de așteptare în stația respectivă, pentru toate rutele
  • station/<station_id>/<route_id> - returnează lista timpului de așteptare în stația respectivă, pentru ruta respectivă
  • stations/<route_id> - returnează lista identificatoarelor stațiilor asociate cu o rută specifică
  • transport/<route_id> - returnează lista datelor telemetrice despre istoria pozițiilor unităților de transport de pe o rută

How to run it

Prerequisites

  1. Make a copy of res/config-sample.yaml to your own config file, e.g. config-development.yaml, supplying the required information in the file
  2. Replicate the environment using virtualenv or pipenv, as described below
  3. When done, run it with python main.py res/config-development.yaml

Virtualenv

  1. Create the virtualenv virtualenv venv-roatarest to install the dependencies in it
  2. Activate the venv with source venv-roatarest/bin/activate
  3. Install the dependencies with pip install -r requirements.txt

Pipenv

  1. Install pipenv pip install pipenv
  2. Then run pipenv install --dev. It will deal automatically with the venv creation and dependecy installing

How to contribute

  1. Run make autoformat to format all .py files
  2. Run make verify and examine the output, looking for issues that need to be addressed

rest-api's People

Contributors

roata avatar

Watchers

James Cloos avatar

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.