Giter VIP home page Giter VIP logo

shanghai-bus's Introduction

上海公交API

运行

FLASK_APP=router.py flask run

接口

1. 公交线路查询接口

接口地址

/bus/<router_name>

请求方式:GET

请求参数

名称 位置 类型 必须 说明
router_name url string 公交线路名称,如:1路、2路
direction query string int 公交行驶方向,上行:0(默认),下行:1

返回参数

名称 类型 说明
from string 公交起点站名称
to string 公交终点站名称
start_at string 首班公交发车时间
end_at string 末班公交发车时间
direction int 公交行驶方向,上行:0,下行:1
stops array 公交站点列表
stop_id string 公交站点的数字代号
stop_name string 公交站点名称

2.公交到站信息查询接口

接口地址

/bus/<router_name>/stop/<stop_id>

请求方式:GET

请求参数

名称 位置 类型 必须 说明
router_name url string 公交线路名称,如:1路、2路
stop_id url int 公交站点的数字代号
direction query string int 公交行驶方向,上行:0(默认),下行:1

返回参数

名称 类型 说明
router_name string 公交线路名称
direction int 公交行驶方向,上行:0,下行:1
plate_number string 公交车车牌号
stop_interval int 公交车到达本站的站数
distance int 当前公交车到达本站的距离
time int 当前公交车到达本站的时间(秒)
status string 公交车状态,waiting:等待发车;running:运行中

3.公交线路详情查询接口

接口地址

/bus/<router_name>/details

请求方式:GET

请求参数

名称 位置 类型 必须 说明
router_name url string 公交线路名称,如:1路、2路
direction query string int 公交行驶方向,上行:0(默认),下行:1

返回参数

名称 类型 说明
from string 公交起点站名称
to string 公交终点站名称
start_at string 首班公交发车时间
end_at string 末班公交发车时间
direction int 公交行驶方向,上行:0,下行:1
stops array 公交站点列表
stop_id string 公交站点的数字代号
stop_name string 公交站点名称
plate_number string 公交车车牌号
stop_interval int 公交车到达本站的站数
distance int 当前公交车到达本站的距离
time int 当前公交车到达本站的时间(秒)
status string 公交车状态,waiting:等待发车;running:运行中

错误响应

返回参数

名称 类型 说明
error string 错误代码
error_msg string 错误说明
400 Bad Request
{
  "error": "router_not_exists",
  "error_msg": "不存在该公交线路"
}
404 Not Found
{
  "error": "page_not_found",
  "error_msg": "页面不存在"
}
500 Internal Server Error
{
  "error": "internal_server_error",
  "error_msg": "服务器内部错误"
}

shanghai-bus's People

Contributors

ark930 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.