redfern314 / southwest-search

Search, sort, and filter Southwest flights based on a number of parameters.
MIT License
13 stars 5 forks source link

add segments #8

Closed RayBB closed 3 years ago

RayBB commented 3 years ago

This is part of #7 but doesn't fully address it.

Basically, the json seems to have changed so that stopsDetails is now nested under segments.

Like this:

Spoiler ```json { "details": [ { "originationAirportCode": "LGA", "destinationAirportCode": "TPA", "departureTime": "14:30", "arrivalTime": "22:10", "nextDay": false, "totalDuration": 460, "flightNumbers": [ "431", "653" ], "filterTags": [ "NOON_TO_SIX", "AVAILABLE", "STOPS" ], "departureDateTime": "2021-06-22T14:30:00.000-04:00", "arrivalDateTime": "2021-06-22T22:10:00.000-04:00", "segments": [ { "originationAirportCode": "LGA", "destinationAirportCode": "HOU", "flightNumber": "431", "duration": "03:55", "numberOfStops": 0, "departureTime": "14:30", "arrivalTime": "17:25", "departureDateTime": "2021-06-22T14:30:00.000-04:00", "arrivalDateTime": "2021-06-22T17:25:00.000-05:00", "operatingCarrierCode": "WN", "marketingCarrierCode": "WN", "aircraftEquipmentType": "73W", "features": [ "WIFI" ], "wifiOnBoard": true, "stopsDetails": [ { "originationAirportCode": "LGA", "destinationAirportCode": "HOU", "flightNumber": "431", "legDuration": 235, "stopDuration": 100, "changePlanes": true, "departureTime": "14:30", "arrivalTime": "17:25", "departureDateTime": "2021-06-22T14:30:00.000-04:00", "arrivalDateTime": "2021-06-22T17:25:00.000-05:00" } ] }, { "originationAirportCode": "HOU", "destinationAirportCode": "TPA", "flightNumber": "653", "duration": "02:05", "numberOfStops": 0, "departureTime": "19:05", "arrivalTime": "22:10", "departureDateTime": "2021-06-22T19:05:00.000-05:00", "arrivalDateTime": "2021-06-22T22:10:00.000-04:00", "operatingCarrierCode": "WN", "marketingCarrierCode": "WN", "aircraftEquipmentType": "73H", "features": [ "WIFI" ], "wifiOnBoard": true, "stopsDetails": [ { "originationAirportCode": "HOU", "destinationAirportCode": "TPA", "flightNumber": "653", "legDuration": 125, "stopDuration": 0, "departureTime": "19:05", "arrivalTime": "22:10", "departureDateTime": "2021-06-22T19:05:00.000-05:00", "arrivalDateTime": "2021-06-22T22:10:00.000-04:00" } ] } ] } ] } ```

This PR fixes that so now you can see results if you're able to get past the header issues!

redfern314 commented 3 years ago

LGTM. I'm actually not able to get the header thing to work anymore... did you successfully test it out? If so, I'll merge this and take a look at the headers later.

redfern314 commented 3 years ago

Thanks for putting up the PR, by the way :)

redfern314 commented 3 years ago

I was able to get it to work - it looks like they're invalidating those headers much more often now, you can only use them once or twice.