Skip to content

hasadna/open-bus-stride-client

Repository files navigation

open-bus-stride-client

Python client library and CLI to interact with the Stride REST API

  • Please report issues and feature requests here
  • To get updates about the system status and for general help join Hasadna's Slack #open-bus channel (Hasadna Slack signup link)

Using the interactive Jupyter notebooks

This project contains several Jupyter notebooks to demonstrate usage.

For a very quickstart without any installation, you can open the notebooks online:

Local Usage

Install the library

pip install --upgrade open-bus-stride-client

API Access

The client provides the following methods for generic API access:

  • stride.get(path, params=None): Make a GET request to the given path with optional params dict
  • stride.iterate(path, params=None, limit=1000): For list operations - iterate over all items up to the given limit.

Refer to the API Docs for the available paths, parameter types and general usage.

CLI Support

Most methods are available via CLI, to install CLI support:

pip install --upgrade open-bus-stride-client[cli]

See the CLI help message for details:

stride --help

SIRI Accessibility Analysis using UrbanAccess

UDST/urbanaccess is a tool for running accessibility analysis. The stride client provides methods which allow to generate UrbanAccess accesibility graphs for the SIRI data.

Install:

pip install --upgrade open-bus-stride-client[cli,urbanaccess]

See the notebook for example usage: siri accessibility analysis using UrbanAccess

See the CLI help messages for available functionality via the CLI:

stride urbanaccess --help

Using API Proxy for local API access

This method allows running locally without depending on the Stride API HTTP endpoint. It requires configuration of Stride API which requires a connection to the Stride DB. See open-bus-stride-api docs for details.

Following steps assume you have a clone of open-bus-stride-api repo at ../open-bus-stride-api, as well as all requirements of open-bus-stride-api, see that repo's README for details.

Install api proxy dependencies

pip install -e .[apiproxy]

Install open-bus-stride-api dependencies

pip install -r ../open-bus-stride-api/requirements-dev.txt
pip install -e ../open-bus-stride-api

Set env vars (assuming you have them setup in open-bus-stride-api):

. ../open-bus-stride-api/.env

Following snippet runs a stride function using the api proxy:

python3 -c "
import stride, stride.api_proxy
with stride.api_proxy.start():
    print(stride.get('/gtfs_stops/list', params={}))
"

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 3

  •  
  •  
  •  

Languages