GithubHelp home page GithubHelp logo

fantomas42 / veliberator Goto Github PK

View Code? Open in Web Editor NEW
8.0 2.0 0.0 238 KB

Veliberator provides a Python API for getting informations about the stations of the Velib' network.

Home Page: http://veliberator.com

License: BSD 3-Clause "New" or "Revised" License

Makefile 2.52% Python 97.48%

veliberator's Introduction

Veliberator

Veliberator is a Python module who provides an API for getting the informations related to the stations of the Velib' bike renting network.

API Usage

To retrieve the informations of a station you only have to have the ID of the station and a database synchronized with all the available stations.

Then in your Python interpreter you can play with the API: :

>>> from veliberator.station import Station
>>> station = Station(42008)
>>> station.informations.address
u'128 AVENUE DANIEL CASANOVA'

The informations attributes contains many data such as:

  • address
  • postal_code
  • city
  • lat (the latitude of the GPS coordonates)
  • lng (the longitude of the GPS coordonates)
  • opened (True if the station is open)
  • bonus (True if the station is a bonus station)

You could retrieve the live status of the station easily: :

>>> station.status.available
24
>>> station.status.free
1
>>> station.status.total
25
>>> station.status.closed
0

More useful, you can retrieve the closest stations sorted by distance: :

>>> station.stations_around
[<StationInformation "42006" (23 RUE PIERRE BROSSOLETTE)>, <StationInformation "42010" (1 RUE ROBESPIERRE)>, ...]

The veliberator script

Write an API for developers is a nice idea, but write an useful script who uses the API for the end-user is a much nicer idea.

So the package provide a script named veliberator.

For exemple if I need to know the status of the Velib' station with the ID: 42008, I simply need to run this command: :

$ veliberator 42008

This command will display the status of the station and find other stations around if no parking place are available.

The veliberator script can also find the Velib' stations around an address, by simply launching the script.

Note that at the first run of the script a database will be created for registering all the available stations.

For update or create the database you can run this command: :

$ veliberator --synchronize

Run this command for more informations: :

$ veliberator -h

Settings

The veliberator module can be configured by a configuration file. Take a look on the file etc/veliberator-sample.cfg for having a example of the options availables.

The module is going to look in your home directory if a file named .veliberator.cfg is present and in etc/veliberator.cfg from your current working directory.

veliberator's People

Contributors

fantomas42 avatar werdeil avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

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