Git Product home page Git Product logo

terminalgv's Introduction

TerminalGV

So I got bored in the train, TerminalGV is a very simple client to display stats about your SNCF TGV/TER train in your terminal.

The "on-train" api (https://wifi.sncf) runs socket.io, you can join the namespace /router/api/pepita and listen for events, this script listen to theses events: gps, connected_devices (Network), internet_link_quality, trainDetails (Stops/Time/Train infos)

Dates are converted to the Europe/Paris timezone edit the ui.py file to change it

SNCF Uses socketio v3 so we need to install python-socketio v4 (I used python-socketio==4.6.1) Screenshot

terminalgv's People

Contributors

thestaticturtle avatar

Stargazers

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

Watchers

 avatar  avatar  avatar  avatar

terminalgv's Issues

Seems to be broken at present

Hi! Having just transferred from a Deutsche Bahn ICE to a TGV, I was curious to see if there was a similar API for requesting the train speed and indeed there was :D I wasn't sure how to read values from the websocket until I found this project, but this unfortunately did not seem to work. I got the following error:

DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): wifi.sncf:443
DEBUG:urllib3.connectionpool:https://wifi.sncf:443 "GET /socket.io/?transport=polling&EIO=4&t=1651772050.4105353 HTTP/1.1" 200 103
Traceback (most recent call last):
  File "/home/ashley/TerminalGV/main.py", line 43, in <module>
    sio.connect('https://wifi.sncf/')
  File "/usr/lib/python3.10/site-packages/socketio/client.py", line 338, in connect
    raise exceptions.ConnectionError(exc.args[0]) from None
socketio.exceptions.ConnectionError: OPEN packet not returned by server

Luckily I realised that there was a fetch api as well, so you can just curl https://wifi.sncf/router/api/train/gps etc. instead.

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.