opentripplanner / OpenTripPlanner

An open source multi-modal trip planner
http://www.opentripplanner.org
Other
2.17k stars 1.02k forks source link

Request Headers for Transit Feeds bulid-config.json #6033

Open ctriley opened 2 weeks ago

ctriley commented 2 weeks ago

Is your feature request related to a problem? Please describe. I want to be able to use the build-config.json file to fetch static GTFS files that require API keys.

Describe the solution you'd like Similar to router-config.json I'd like a "headers" key in the build config. Example from routers-config.json

  "updaters" : [ {
    "type" : "real-time-alerts",
    "frequencySec" : 30,
    "url" : "http://developer.trimet.org/ws/V1/FeedSpecAlerts/appID/0123456789ABCDEF",
    "feedId" : "TriMet"
  }, {
    "type" : "vehicle-rental",
    "network" : "socialbicycles_coast",
    "sourceType" : "gbfs",
    "language" : "en",
    "frequencySec" : 60,
    "allowKeepingRentedBicycleAtDestination" : true,
    "url" : "http://coast.socialbicycles.com/opendata/gbfs.json",
    "headers" : {
      "Auth" : "<any-token>",
      "<key>" : "<value>"
    }

proposed build-config.json

{
  "transitFeeds": [
    {
      "type": "gtfs",
      "feedId": "wmata-dc-us",
      "source": "https://api.wmata.com/gtfs/rail-bus-gtfs-static.zip",
      "headers": {
          "api_key": ""
      }
    }
  ]
}

Describe alternatives you've considered I can fetch the gtfs files and store them in a folder outside of OTP startup, but this is less clean and requires additional scripting.

t2gran commented 6 days ago

You will need to change the HttpDataSource in otp to do this. Should be stright forward. If you want some guidence, I recommends calling into one of the developer meetings.