kevinpCroat / PyBikes

Some python class wrappers to parse info from bike sharing networks across the world. This project is related to CityBikes, as to provide info for the application, thus allowing others to access the same data. It provides the information for the API used by CityBikes

Home Page:http://api.citybik.es

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

=======
PyBikes
=======

PyBikes provides a set of tools to scrape bike sharing data from different 
websites and APIs, thus providing a coherent and generalized set of classes
and methods to access this sort of information. 

This library is distributed and intended mainly for statistics and data 
sharing projects. More importantly, it powers the CityBikes project[1].

The library is composed of a set of classes (under pybikes), and a pack of 
data files that provide instances for all different systems.

Usual usage(:):
    #! /usr/bin/env python

    >>> import pybikes
    
    # Capital BikeShare instantiation data is on bixi.json file under 'cabi'
    >>> capital_bikeshare = pybikes.getBikeShareSystem('bixi','cabi')

    # The instance contains all possible metadata regarding this system
    >>> print(capital_bikeshare.meta)
    {
        'name': 'Capital BikeShare', 
        'city': 'Washington, DC - Arlington, VA', 
        'longitude': -77.0363658, 
        'system': 'Bixi', 
        'company': 'PBSC', 
        'country': 'USA', 
        'latitude': 38.8951118
    }
    # The update method retrieves the list of stations
    >>> print(len(capital_bikeshare.stations))
    0
    >>> capital_bikeshare.update()
    >>> print(len(capital_bikeshare.stations))
    191
    >>> print(capital_bikeshare.stations[0])
    --- 31000 - 20th & Bell St ---
    bikes: 7
    free: 4
    latlng: 38.8561,-77.0512
    extra: {
        'installed': True, 
        'uid': 1, 
        'locked': False, 
        'removalDate': '', 
        'installDate': '1316059200000', 
        'terminalName': '31000', 
        'temporary': False, 
        'name': '20th & Bell St', 
        'latestUpdateTime': '1353454305589'
    }

    # Note that pybikes works as an instance factory and, alternately, you 
    # could get the same instance by passing the right arguments to a
    # desired class

    >>> from pybikes import BixiSystem
    >>> capital_bikeshare = BixiSystem(
            tag = 'foo_tag', 
            root_url = 'http://capitalbikeshare.com/data/stations/', 
            meta = {'foo':'bar'})


[1]: http://www.citybik.es

About

Some python class wrappers to parse info from bike sharing networks across the world. This project is related to CityBikes, as to provide info for the application, thus allowing others to access the same data. It provides the information for the API used by CityBikes

http://api.citybik.es

License:GNU Lesser General Public License v3.0


Languages

Language:Python 99.9%Language:Shell 0.1%