剛入坑這個程式
連接url到政府的youbike之後都會跳出404項
目前想做到 可以使用者輸入代碼後
只顯示輸入代碼的資料
希望有大神可以幫忙
看了一整天的電腦找不到解答QQ
附上5000p 感謝
或是輸入城市也可以
目前程式碼
import requests
import json
import pandas as pd
def show(request):
conn = None
url = "https://tcgbusfs.blob.core.windows.net/blobyoubike/YouBikeTP.gz"
data = requests.get(url).json()
z = input("請輸入城市")
if z in data:
print(z)
for key, value in data["retVal"].items():
sno = value["sno"]
sna = value["sna"]
tot = value["tot"]
sbi = value ["sbi"]
sarea = value ["sarea"]
mday = value ["mday"]
lat = value ["lat"]
lng = value["lng"]
ar = value["ar"]
sareaen =value ["sareaen"]
snaen =value ["snaen"]
aren =value ["aren"]
bemp =value["bemp"]
act = value["act"]
print("代號:", sno,"名稱:", sna,"停車格:", tot,"目前車輛數量:", sbi,"場站區域:", sarea,"資料更新時間:", mday,"緯度:", lat,"經度:", lng,"地:", ar,"場站區:", sareaen,"場站名:", snaen,"地址:", aren,"空位數量:", bemp,"全站禁用狀態:", act )