Skip to content

mmmddd98/nextbike

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

38 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

NextBike API

Interact with the Nextbike API and fetch real-time bike-sharing data for various countries, organizations, cities, stations, and bikes. The data is processed and organized into data classes, making it easy to work with and log the data to files for further analysis.

Examples

This package can easily used to visualize bike-distributions across different cities:

Resized image

Resized image

Installation

You can run from the terminal:

pip install git+https://github.com/sIDsID11/nextbike

Basic Usage

Setup

Import the Client class and create an instance of it.

from nextbike import Client
c = Client()

Direct access

Fetch the latest data from the Nextbike API into the client.

c.fetch()

Access the data using the available methods.

de = c.get_country("de")
frelo = c.get_organization("Frelo Freiburg")
freiburg = c.get_city(619)
messe_uni = c.get_station(15430457)
bike = c.get_bike(32928)

Scraping

Scrape data at regular intervals into JSON files.

c.scrape(interval_secs=5 * 60, 
        country_codes=["de"],
        organization_names=["Frelo Freiburg"],
        city_ids=[619],
        station_ids=[15430457],
        bike_ids=[32928])

Load data from stored JSON files later on for further analysis.

country = c.load_country("file_path")
organization = c.load_organization("file_path")
city = c.load_city("file_path")
station = c.load_station("file_path")
bike = c.load_bike("file_path")

Visualization

Visualize a country, organization or city.

country = Country(...)
heatmap(country)  # Creates an html file of the heatmap

city = City(...)
bikemap(city)  # Creates an html file of the bikemap

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 100.0%