{"id":21607887,"url":"https://github.com/ark930/shanghai-bus","last_synced_at":"2025-10-08T23:41:21.086Z","repository":{"id":75422357,"uuid":"96836721","full_name":"ark930/shanghai-bus","owner":"ark930","description":"上海公交信息实时查询接口","archived":false,"fork":false,"pushed_at":"2019-05-18T13:12:47.000Z","size":24,"stargazers_count":58,"open_issues_count":1,"forks_count":22,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-04-11T04:37:13.566Z","etag":null,"topics":["api","bus","shanghai"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ark930.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-07-11T01:24:56.000Z","updated_at":"2024-05-23T11:26:10.000Z","dependencies_parsed_at":"2023-06-06T11:00:15.833Z","dependency_job_id":null,"html_url":"https://github.com/ark930/shanghai-bus","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ark930%2Fshanghai-bus","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ark930%2Fshanghai-bus/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ark930%2Fshanghai-bus/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ark930%2Fshanghai-bus/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ark930","download_url":"https://codeload.github.com/ark930/shanghai-bus/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248345256,"owners_count":21088231,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["api","bus","shanghai"],"created_at":"2024-11-24T20:34:27.673Z","updated_at":"2025-10-08T23:41:16.042Z","avatar_url":"https://github.com/ark930.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# 上海公交API\n\n## 运行\n``` sh\nFLASK_APP=router.py flask run\n```\n\n## 接口\n#### 1. 公交线路查询接口\n**接口地址**：\n``` url\n/bus/\u003crouter_name\u003e\n```\n\n**请求方式**：GET\n\n**请求参数**：\n\n| 名称 | 位置 | 类型 | 必须 | 说明 |\n| --- | --- | --- | --- | --- |\n| router_name | url | string | 是 | 公交线路名称，如：1路、2路 |\n| direction | query string | int | 否 | 公交行驶方向，上行：0（默认），下行：1 |\n\n**返回参数**：\n\n| 名称 | 类型 | 说明 |\n| --- | --- | --- |\n| from | string | 公交起点站名称 |\n| to | string | 公交终点站名称 |\n| start_at | string | 首班公交发车时间 |\n| end_at | string | 末班公交发车时间 |\n| direction | int | 公交行驶方向，上行：0，下行：1 |\n| stops | array | 公交站点列表 |\n| stop_id | string | 公交站点的数字代号 |\n| stop_name | string |  公交站点名称 |\n\n---\n\n#### 2.公交到站信息查询接口\n**接口地址**：\n``` url\n/bus/\u003crouter_name\u003e/stop/\u003cstop_id\u003e\n```\n\n**请求方式**：GET\n\n**请求参数**：\n\n| 名称 | 位置 | 类型 | 必须 | 说明 |\n| --- | --- | --- | --- | --- |\n| router_name | url | string | 是 | 公交线路名称，如：1路、2路 |\n| stop_id | url | int | 是 | 公交站点的数字代号 |\n| direction | query string | int | 否 | 公交行驶方向，上行：0（默认），下行：1 |\n\n**返回参数**：\n\n| 名称 | 类型 | 说明 |\n| --- | --- | --- |\n| router_name | string | 公交线路名称 |\n| direction | int | 公交行驶方向，上行：0，下行：1 |\n| plate_number | string | 公交车车牌号 |\n| stop_interval | int | 公交车到达本站的站数 |\n| distance | int | 当前公交车到达本站的距离 |\n| time | int | 当前公交车到达本站的时间（秒） |\n| status | string | 公交车状态，waiting：等待发车；running：运行中 |\n\n---\n\n#### 3.公交线路详情查询接口\n**接口地址**：\n``` url\n/bus/\u003crouter_name\u003e/details\n```\n\n**请求方式**：GET\n\n**请求参数**：\n\n| 名称 | 位置 | 类型 | 必须 | 说明 |\n| --- | --- | --- | --- | --- |\n| router_name | url | string | 是 | 公交线路名称，如：1路、2路 |\n| direction | query string | int | 否 | 公交行驶方向，上行：0（默认），下行：1 |\n\n**返回参数**：\n\n| 名称 | 类型 | 说明 |\n| --- | --- | --- |\n| from | string | 公交起点站名称 |\n| to | string | 公交终点站名称 |\n| start_at | string | 首班公交发车时间 |\n| end_at | string | 末班公交发车时间 |\n| direction | int | 公交行驶方向，上行：0，下行：1 |\n| stops | array | 公交站点列表 |\n| stop_id | string | 公交站点的数字代号 |\n| stop_name | string |  公交站点名称 |\n| plate_number | string | 公交车车牌号 |\n| stop_interval | int | 公交车到达本站的站数 |\n| distance | int | 当前公交车到达本站的距离 |\n| time | int | 当前公交车到达本站的时间（秒） |\n| status | string | 公交车状态，waiting：等待发车；running：运行中 |\n\n---\n\n#### 错误响应\n\n**返回参数**：\n\n| 名称 | 类型 | 说明 |\n| --- | --- | --- |\n| error | string | 错误代码 |\n| error_msg | string | 错误说明 |\n\n##### 400 Bad Request\n``` json\n{\n  \"error\": \"router_not_exists\",\n  \"error_msg\": \"不存在该公交线路\"\n}\n```\n\n##### 404 Not Found\n``` json\n{\n  \"error\": \"page_not_found\",\n  \"error_msg\": \"页面不存在\"\n}\n```\n\n##### 500 Internal Server Error\n``` json\n{\n  \"error\": \"internal_server_error\",\n  \"error_msg\": \"服务器内部错误\"\n}\n```\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fark930%2Fshanghai-bus","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fark930%2Fshanghai-bus","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fark930%2Fshanghai-bus/lists"}