Fixed kmb again for schedules
This commit is contained in:
@@ -4,7 +4,6 @@ import (
|
|||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
"net/http"
|
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
@@ -35,16 +34,12 @@ func getSchedule( r *RouteStop ) ( *[] *Schedule, error ) {
|
|||||||
)
|
)
|
||||||
|
|
||||||
QUERY_FUNC := func() (io.ReadCloser, error) {
|
QUERY_FUNC := func() (io.ReadCloser, error) {
|
||||||
resp, err := http.Get( fmt.Sprintf(
|
return utils.HttpGet(fmt.Sprintf(
|
||||||
"https://data.etabus.gov.hk/v1/transport/kmb/eta/%s/%s/%s",
|
"https://data.etabus.gov.hk/v1/transport/kmb/eta/%s/%s/%s",
|
||||||
r.BusStop.BusStopId,
|
r.BusStop.BusStopId,
|
||||||
r.RouteId,
|
r.RouteId,
|
||||||
r.ServiceType,
|
r.ServiceType,
|
||||||
))
|
))
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
return resp.Body, nil
|
|
||||||
}
|
}
|
||||||
|
|
||||||
buff, err := utils.CacheStream(CACHE_PATH, QUERY_FUNC, 60)
|
buff, err := utils.CacheStream(CACHE_PATH, QUERY_FUNC, 60)
|
||||||
|
|||||||
Reference in New Issue
Block a user