GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - gyfstephen/shanghai-bus: 上海公交信息API查询

BranchesTags
Open more actions menu

Latest commit

 

History

19 Commits
19 Commits

Folders and files

NameName
Last commit message
Last commit date
.gitignore
.gitignore
 
 
README.md
README.md
 
 
app.py
app.py
 
 
bus.py
bus.py
 
 
requirements.txt
requirements.txt
 
 
settings.py
settings.py
 
 
test
test
 
 

Repository files navigation

上海公交信息API查询

数据来源:上海发布

API接口:

  • 查询车辆站台信息

    /api/v1/stations/<string:stop_type>/<int:number>/
    
  • 查询车辆到站信息

    /api/v1/stops/<string:stop_type>/<int:number>/
    

示例:

  • 查询公交100上行站台信息 /api/v1/stations/up/110/
{
    "data": {
        "1": "吉浦路仁德路", 
        "2": "武川路武东路", 
        "3": "武川路政立路", 
        "4": "政立路国权北路", 
        "5": "政立路逸仙路", 
        "6": "逸仙路场中路", 
        "7": "江湾(逸仙路)", 
        "8": "逸仙路纪念路", 
        "9": "大柏树(曲阳路)", 
        "10": "曲阳路中山北二路", 
        "11": "大连西路曲阳路", 
        "12": "欧阳路大连西路", 
        "13": "欧阳路祥德路", 
        "14": "欧阳路四达路", 
        "15": "欧阳路吉祥路", 
        "16": "四平路溧阳路", 
        "17": "吴淞路海宁路", 
        "18": "吴淞路天潼路"
    }, 
    "error": 0, 
    "msg": ""
}
  • 查询公交100上行到站信息 /api/v1/stops/up/110/
{
    "data": [
        {
            "distance": 0, 
            "error": 0, 
            "plate": "沪A-00737D", 
            "station_name": "吉浦路仁德路", 
            "stop_dis": 1, 
            "stop_id": 1, 
            "time": 929
        }, 
        {
            "distance": 1296, 
            "error": 0, 
            "plate": "沪A-00737D", 
            "station_name": "武川路武东路", 
            "stop_dis": 1, 
            "stop_id": 2, 
            "time": 1048
        }, 
        {
            "distance": 1548, 
            "error": 0, 
            "plate": "沪A-00737D", 
            "station_name": "武川路政立路", 
            "stop_dis": 2, 
            "stop_id": 3, 
            "time": 1110
        }, 
        {
            "distance": 2203, 
            "error": 0, 
            "plate": "沪A-00737D", 
            "station_name": "政立路国权北路", 
            "stop_dis": 3, 
            "stop_id": 4, 
            "time": 1289
        }, 
        {
            "distance": 576, 
            "error": 0, 
            "plate": "沪A-01825D", 
            "station_name": "政立路逸仙路", 
            "stop_dis": 1, 
            "stop_id": 5, 
            "time": 88
        }, 
        {
            "distance": 1175, 
            "error": 0, 
            "plate": "沪A-01825D", 
            "station_name": "逸仙路场中路", 
            "stop_dis": 2, 
            "stop_id": 6, 
            "time": 208
        }, 
        {
            "distance": 1590, 
            "error": 0, 
            "plate": "沪A-01825D", 
            "station_name": "江湾(逸仙路)", 
            "stop_dis": 3, 
            "stop_id": 7, 
            "time": 269
        }, 
        {
            "distance": 1882, 
            "error": 0, 
            "plate": "沪A-01825D", 
            "station_name": "逸仙路纪念路", 
            "stop_dis": 4, 
            "stop_id": 8, 
            "time": 388
        }, 
        {
            "distance": 3142, 
            "error": 0, 
            "plate": "沪A-01825D", 
            "station_name": "大柏树(曲阳路)", 
            "stop_dis": 5, 
            "stop_id": 9, 
            "time": 628
        }, 
        {
            "distance": 293, 
            "error": 0, 
            "plate": "沪A-07566D", 
            "station_name": "曲阳路中山北二路", 
            "stop_dis": 1, 
            "stop_id": 10, 
            "time": 31
        }, 
        {
            "distance": 1642, 
            "error": 0, 
            "plate": "沪A-07566D", 
            "station_name": "大连西路曲阳路", 
            "stop_dis": 2, 
            "stop_id": 11, 
            "time": 331
        }, 
        {
            "distance": 2170, 
            "error": 0, 
            "plate": "沪A-07566D", 
            "station_name": "欧阳路大连西路", 
            "stop_dis": 3, 
            "stop_id": 12, 
            "time": 449
        }, 
        {
            "distance": 2579, 
            "error": 0, 
            "plate": "沪A-07566D", 
            "station_name": "欧阳路祥德路", 
            "stop_dis": 4, 
            "stop_id": 13, 
            "time": 569
        }, 
        {
            "distance": 2867, 
            "error": 0, 
            "plate": "沪A-07566D", 
            "station_name": "欧阳路四达路", 
            "stop_dis": 5, 
            "stop_id": 14, 
            "time": 630
        }, 
        {
            "distance": 3196, 
            "error": 0, 
            "plate": "沪A-07566D", 
            "station_name": "欧阳路吉祥路", 
            "stop_dis": 6, 
            "stop_id": 15, 
            "time": 689
        }, 
        {
            "distance": 4019, 
            "error": 0, 
            "plate": "沪A-07566D", 
            "station_name": "四平路溧阳路", 
            "stop_dis": 7, 
            "stop_id": 16, 
            "time": 870
        }, 
        {
            "distance": 728, 
            "error": 0, 
            "plate": "沪A-05870D", 
            "station_name": "吴淞路海宁路", 
            "stop_dis": 1, 
            "stop_id": 17, 
            "time": 90
        }, 
        {
            "distance": 1329, 
            "error": 0, 
            "plate": "沪A-05870D", 
            "station_name": "吴淞路天潼路", 
            "stop_dis": 2, 
            "stop_id": 18, 
            "time": 330
        }
    ], 
    "error": 0, 
    "msg": ""
}

TODO:

  • 支持查询非数字的线路
  • 缓存时间优化
  • 支持查询特定站到站时间
  • 支持查询同一站的多条线路

About

上海公交信息API查询

Topics

busshanghai

Resources

Readme
Activity

Stars

16 stars

Watchers

2 watching

Forks

5 forks
Report repository

Releases

Packages

Used by

Contributors

Languages

You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.