To run as a docker container cd into the directory which you pulled the repo into and:
$ docker-compose build
$ docker-compose up -dTo run as a native application without docker, cd into the project directory
$ export PYTHON_PATH=./extenstions/
$ pip install -r requirements.txtTo initialize the server
$ python server.pyOr using gunicorn you for concurrency (adjusting -w parameter)
$ gunicorn server:app -k gevent -w 4/config.py
- flask - change the host, port, proto and threading mode of flask web application
- nextbus - contains all the nextbus xml feel url components (dont need to change)
- rate-limiter - decrease / increase the ratelimiting parameters on all of the non-internal endpoints. Current default is set at 1 request / 30 seconds / endpoint-params
- gzip - adjust the compression ratio of gzip module (lowest=1, highest=9)
- slow_queries - adjust the time (ms) threshold that defines a slow_query (default .5), if a given query exceeds this value, it will be logged into the redis SLOW_QUERIES hash and accessible via the /stats/slow endpoint
- redis - adjust the redis hostname and listening ports
- logging - adjust the output directory and path
Endpoints and brief descriptions can be listed via the /endpoints endpoint
$ curl http://localhost:8889/endpointsEach object contains the actual endpoint name, endpoint rule (url structure), and description.
/routes : Provides a list off all the NextBus routes by name and tag.
- verbose = true,false
- terse = true,false
/routes/<routeTag>: Provides more detailed configuration info for a given routeTag, including stopId, stopTag,
- verbose = true,false
- terse = true,false
/routes : Provides a list off all the NextBus routes by name and tag, use r key in query string to specify route tag.
r= for one routeTag:r=N_OWLr[]= for multiple routeTags, seperated by a comma:r[]=N_OWL,45,61
$ curl "http://127.0.0.1:8889/routes/messages?r\[\]=T_OWL,61"verbose= true,falseterse= true,false
/routes/<routeTag>/schedule : Returns the routes' timetable, grouped into direction, and schedule class groups.
- verbose = true,false
- terse = true,false
/stops/<stopId>/predictions : Show prediction by route with stopId only - least specific
- verbose = true,false
- terse = true,false
/stops/<stopId>/routes/<routeTag>/predictions : Show prediction by route with stopId and routeTag - mid specific .
- verbose = true,false
- terse = true,false
/routes/<routeTag>/stops/<stopTag>/predictions : Show prediction by routes with routeTag and stopId - most specific.
- verbose = true,false
- terse = true,false
/routes/<routeTag>/vehicles : Returns currently acitve vehicles for specified routeTag.
- verbose = true,false
- terse = true,false
/endpoints/stats/<endpoint> : Returns a stats object which lists the total bytes and total hits of each endpoint beginning from the last time application was started.
- verbose = true,false
- terse = true,false
stats_slowqueries : Returns most recent queries which exceeded the 'slow_threshold' parameter. Parameter can be adjusted in the config.py file. The default number of queries returned is 30, use row_limit parameter to adjust.
- row_limit = used to change the number of rows returned sorted in descending order by time of query:
row_limit=40 - verbose = true,false
- terse = true,false