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.
This package can easily used to visualize bike-distributions across different cities:
You can run from the terminal:
pip install git+https://github.com/sIDsID11/nextbikeImport the Client class and create an instance of it.
from nextbike import Client
c = Client()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)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")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
