Skip to content

Commit

Permalink
add nj transit download custom
Browse files Browse the repository at this point in the history
  • Loading branch information
kylerchin committed Nov 14, 2024
1 parent 8c839d1 commit f5cb046
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 5 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ crossbeam-utils = "0.8.20"
memoffset = "0.9.1"
time = "0.3.36"
rouille = "3.0"
reqwest = {version = "0.12", features = ["gzip","brotli","rustls-tls","deflate","cookies"]}
reqwest = {version = "0.12", features = ["gzip","brotli","rustls-tls","deflate","cookies","multipart"]}
protobuf = "3.7.1"
csv = "1.3"
serde = { version = "1.0", features = ["derive"] }
Expand Down
2 changes: 1 addition & 1 deletion src/birch/get_agencies.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ use catenary::models::IpToGeoAddr;
use catenary::postgis_to_diesel::diesel_multi_polygon_to_geo;
use catenary::postgres_tools::{make_async_pool, CatenaryPostgresPool};
use catenary::EtcdConnectionIps;
use diesel::prelude::*;
use diesel::ExpressionMethods;
use diesel::SelectableHelper;
use diesel_async::RunQueryDsl;
use diesel::prelude::*;
use geojson::{Feature, GeoJson, JsonValue};
use ordered_float::Pow;
use serde::Deserialize;
Expand Down
17 changes: 17 additions & 0 deletions src/maple/transitland_download.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,23 @@ async fn try_to_download(
) -> Result<reqwest::Response, reqwest::Error> {
let new_url = transform_for_bay_area(url.to_string());

if feed_id == "f-dr5-nj~transit~rail" {
let form = reqwest::multipart::Form::new()
//i dont care, whatever, leak it, so what?
.text("token", "638671989162459331");

let request = client
.request(
reqwest::Method::POST,
"https://raildata.njtransit.com/api/GTFSRT/getGTFS",
)
.multipart(form);

let request = add_auth_headers(request, feed_id);

return request.send().await;
}

let request = client.get(&new_url);

let request = add_auth_headers(request, feed_id);
Expand Down
4 changes: 1 addition & 3 deletions src/models.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,11 @@
use compact_str::CompactString;
use diesel::pg::Pg;
use diesel::prelude::*;
use diesel::FromSqlRow;
use diesel::sql_types::*;
use serde_derive::Deserialize;
use serde_derive::Serialize;
use serde_json::Value;

use diesel::sql_types::*;

#[derive(Queryable, Selectable, Insertable, Clone, Serialize, Deserialize, QueryableByName)]
#[diesel(table_name = crate::schema::gtfs::itinerary_pattern)]
pub struct ItineraryPatternRow {
Expand Down

0 comments on commit f5cb046

Please sign in to comment.