Skip to main content

Python API for Velib.

Project description

Veliberator
===========

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


.. contents::

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

veliberator-0.3.tar.gz (102.1 kB view details)

Uploaded Source

File details

Details for the file veliberator-0.3.tar.gz.

File metadata

  • Download URL: veliberator-0.3.tar.gz
  • Upload date:
  • Size: 102.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for veliberator-0.3.tar.gz
Algorithm Hash digest
SHA256 b01da83991a9098a57af247adac005223dd65284af189d5120537c18fda1d722
MD5 b67992babc0a6a1a4433c284d18c7883
BLAKE2b-256 b6aab7fd91c8ecc45f10529d483734ee6c1d1b8be122e4cbb46d4c5ed7a69b42

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page