Giter Site home page Giter Site logo

atm's Introduction

atm

ATM (Azienda Trasporti Milanesi) Python Library

This Library is intended for educational purpose.

  • Free to use.
  • No API Key needed.
  • Daily useful.
  • Functionality tested in real time.

Initial Version - 0.1

In [1]: from atm import Stop

In [2]: s = Stop(11161)

In [3]: s.description()
Fermata 11161 (Alzaia Nav. Pavese, 60) | 2020-02-10 23:04:32.617598

In [4]: s.waitmessage('grid')

11161 - Alzaia Nav. Pavese, 60
+---------+------------------------------+----------+
|   Linea | Descrizione                  | Attesa   |
+=========+==============================+==========+
|      59 | P.ta Lodovica - Famagosta M2 | no serv. |
+---------+------------------------------+----------+
|      71 | Famagosta M2 - Romolo M2     | 5 min    |
+---------+------------------------------+----------+
 - 2020-02-10 23:04:32.617598 - 

In [5]: s.position()
Out[5]: (9.176054951924698, 45.44497959284472)

In [6]: s.lines()
Out[6]: ['59', '71']

In [7]: s.update()

In [8]: s.waitmessage('html')

11161 - Alzaia Nav. Pavese, 60
LineaDescrizione Attesa
59P.ta Lodovica - Famagosta M2no serv.
71Famagosta M2 - Romolo M2 14 min
- 2020-02-10 23:16:08.537093 -

In [9]: from atm import distance

In [10]: s1 = Stop(12402)

In [11]: s2 = Stop(12400)

In [12]: distance(s1,s2)
Out[12]: 0.1354349258943788

In [13]: from atm import Line

In [14]: l = Line(73)

In [15]: l.description()
Linea Bus 73 Aeroporto Linate - Duomo M1 M3

In [16]: l.stops()
Out[16]: ['12926', '12921', '12854', '12852', '18119', '12647', '12405', '12400', '12391', '12127', '12125', '12111', '12098', '12095', '11820', '17854', '18155', '17769', '17855', '16929']

In [17]: l.path('html')

Bus 73 Aeroporto Linate - Duomo M1 M3
FermataDescrizione
12926Aeroporto di Linate Segrate
12921V.le Forlanini Via Circonvallazione Segrate
12854V.le Forlanini Aeronautica Militare
12852V.le Forlanini Tangenziale Est
18119V.le Forlanini P.za Artigianato
12647Forlanini
12405V.le Corsica Via Lomellina
12400V.le Corsica Via Battistotti Sassi
12391V.le Campania V.le Corsica
12127P.za Grandi
12125P.za Emilia
12111Via Cadore C.so Ventidue Marzo
12098P.za S.Maria del Suffragio
12095P.za 5 Giornate
11820C.so P.ta Vittoria Camera del Lavoro
17854Via Battisti
18155L.go Augusto
17769Via Larga
17855P.za Velasca
16929Duomo M1 M3

In [18]: l.reverse()

In [19]: l.path()

Bus 73 Duomo M1 M3 - Aeroporto Linate
+-----------+----------------------------------------------+
|   Fermata | Descrizione                                  |
+===========+==============================================+
|     16929 | Duomo M1 M3                                  |
+-----------+----------------------------------------------+
|     11794 | Via Larga                                    |
+-----------+----------------------------------------------+
|     11798 | L.go Augusto                                 |
+-----------+----------------------------------------------+
|     11816 | Palazzo di Giustizia                         |
+-----------+----------------------------------------------+
|     11823 | C.so P.ta Vittoria  Camera del Lavoro        |
+-----------+----------------------------------------------+
|     12094 | P.za 5 Giornate                              |
+-----------+----------------------------------------------+
|     12099 | P.za S.Maria del Suffragio                   |
+-----------+----------------------------------------------+
|     12108 | Via Cadore C.so Ventidue Marzo               |
+-----------+----------------------------------------------+
|     12126 | P.za Emilia                                  |
+-----------+----------------------------------------------+
|     12390 | P.za Grandi                                  |
+-----------+----------------------------------------------+
|     12392 | V.le Campania V.le Corsica                   |
+-----------+----------------------------------------------+
|     12402 | V.le Corsica Via Lomellina                   |
+-----------+----------------------------------------------+
|     12407 | V.le Corsica Via Negroli                     |
+-----------+----------------------------------------------+
|     12646 | Forlanini                                    |
+-----------+----------------------------------------------+
|     12662 | V.le Forlanini P.za Artigianato              |
+-----------+----------------------------------------------+
|     12851 | V.le Forlanini  Tangenziale Est              |
+-----------+----------------------------------------------+
|     12853 | V.le Forlanini  Aeronautica Militare         |
+-----------+----------------------------------------------+
|     12922 | V.le Forlanini Via Circonvallazione  Segrate |
+-----------+----------------------------------------------+
|     12926 | Aeroporto di Linate  Segrate                 |
+-----------+----------------------------------------------+

atm's People

Contributors

pitfallharry 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.