Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fare check index error #224

Closed
k3vint opened this issue Feb 14, 2024 · 9 comments
Closed

Fare check index error #224

k3vint opened this issue Feb 14, 2024 · 9 comments
Labels
bug Something isn't working

Comments

@k3vint
Copy link

k3vint commented Feb 14, 2024

Version

7.2

Browser Version

121.0.6167.160

Description

This started happening 3-4 days ago. Fare check causes IndexError. I've tried using account login and individual reservations in config. Also tried on a Linux and Windows machine. Same error every time.

To Reproduce

Run a fare check, by account login or by reservations

Expected Behavior

No response

Relevant logs and program output

2024-02-14 16:00:19 DEBUG Process-4[reservation_monitor:93]: Checking fares for 1 flights
2024-02-14 16:00:19 DEBUG Process-4[fare_checker:30]: Checking current price for flight
2024-02-14 16:00:19 DEBUG Process-4[fare_checker:88]: Retrieving reservation information
2024-02-14 16:00:21 DEBUG Process-4[utils:32]: Successfully made request after 1 attempts
2024-02-14 16:00:21 DEBUG Process-4[fare_checker:103]: Retrieving search information for the current flight
2024-02-14 16:00:26 DEBUG Process-4[utils:32]: Successfully made request after 1 attempts
2024-02-14 16:00:26 ERROR Process-4[reservation_monitor:106]: Unexpected error during fare check: IndexError('list index out of range')
Traceback (most recent call last):
  File "/home/user/auto-southwest-check-in/lib/reservation_monitor.py", line 100, in _check_flight_fares
    fare_checker.check_flight_price(flight)
  File "/home/user/auto-southwest-check-in/lib/fare_checker.py", line 31, in check_flight_price
    flight_price = self._get_flight_price(flight)
  File "/home/user/auto-southwest-check-in/lib/fare_checker.py", line 49, in _get_flight_price
    flights, fare_type = self._get_matching_flights(flight)
  File "/home/user/auto-southwest-check-in/lib/fare_checker.py", line 80, in _get_matching_flights
    fare_type = fare_type_bounds[bound]["fareProductDetails"]["fareProductId"]
IndexError: list index out of range
2024-02-14 16:00:26 DEBUG Process-4[reservation_monitor:80]: Lock released

Additional context

Linux Mint and Windows 10, without docker

@k3vint k3vint added the bug Something isn't working label Feb 14, 2024
@jdholtz
Copy link
Owner

jdholtz commented Feb 15, 2024

Thanks for testing this issue out in multiple environments to confirm it is present in every situation. Is the flight a round-trip flight?

To provide more debugging information, could you add the line print(change_flight_page, fare_type_bounds) to line 80 of lib/fare_checker.py and paste the output here (removing sensitive information as necessary)?

@k3vint
Copy link
Author

k3vint commented Feb 15, 2024

All of my flights are one-way.

2024-02-15 06:16:35 DEBUG Process-4[utils:32]: Successfully made request after 1 attempts {'messages': [{'key': 'CHANGE_FEE_MESSAGE', 'header': 'none', 'body': "Select the flight(s) you'd like to modify. We never charge change fees. You'll pay only the difference in fare.", 'icon': 'NONE', 'textColor': 'DEFAULT'}], 'dynamicWaivers': [], 'selectionMode': 'ALL', 'boundSelections': [{'flightType': 'Departure', 'originalDate': '2024-04-05', 'fromAirport': 'AAA', 'fromAirportCode': 'BBB', 'toAirport': 'Los Angeles, CA', 'toAirportCode': 'LAX', 'flight': '1111\u200b/\u200b2271', 'timeDeparts': '02:20', 'timeArrives': '13:05', 'showWarningIcon': False, 'isSelectable': True}], 'splitPnrDetails': None, 'passengerDetails': {'disclaimerTextWithLinks': '', 'title': 'PASSENGER(S)', 'passengerList': [{'displayName': 'first last'}]}, '_links': {'changeShopping': {'href': 'v1/mobile-air-booking/page/flights/change/shopping', 'method': 'POST', 'body': [{'boundReference': 'eyJhbGciOiJkaXIiLCJlbmMiLUhTMjU2In0..0YLkbZ1USKinxRuu_TRyQg.mikt0jgweyPXIQg4NmzLxl9C93IUgwmo_5uS8vxkxi1R7GfTjjp-HqxkqVutFOWxcxXBqj4YkgblsscO28UOj1Kp60tLPI4JgNzCzWYy317T392gp5dhsEZKa4yn1NQmpk2Hq0LOa4M8RjgTk6zpnlpqm71_exdG2l4PfZA61nFllF8TYJVcyR04OLF9tSYeS23y-NnZ2kgeRYTrQGku1eWN1o_gvkAszvYE4AWBPEBQ6CWzGOfhDtFMwaiLE5tPMaTwObu7rc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YTsOPEUJSMyUn9yG95v6bdnSjDRq3NmdNlwroDe5eExOjRPajWJU0KGEF2QNaCGsrhThCXuHpWS2ccca6aF3FzFyRvV47bcTng0AjCqUyYY_w8LBIRNGGsDOFyEpdhd51YEXwSgDQEhQe4JvIjdlnbE07yBY3V4FxsQH6xb3LuqAKc5Q6MDjh86RzmfJava2vx3LZfovcFvyB5oubiglyXawHPX0HuC7mH45t5VR0I5Atqp2sSWcuvZsPo82UfnzKkrMzsrP3J2HeJBhfb90HwTtxvruEN-TrPU3SKdv3GOhU7X58K3sTgV3zTGUq_gv7keP8s5vB6Bak8qk-i_Hut9-2c07JZ_byiZi368j915oTFnVshl-DLN91zNdeXHUpEA7UMtsX1KKpdwyc0G52FRKEubyThIA3sNQFPBqA624EyTxu4s6dDMZkZk1RUg_jO7FlxlaKYHC5Ae667kyfo4oIu4t-sA6g7ewM_BTk5xwDJorEDcIBWyLkC15Zz3GYwt2FRupUJGALNyg1dbdnvcYEakCU18JUV6umPB2X9MLizL1IAGwcAaCKHl733KI1uZ4smxo4fREEXp6AK3KYXNSFCSSQu53DTPRupR1s03Hf_JXr3RynDCHlDnDUmHT-PMUPX9wiPeZd0bnFbB0MMUR496tbsQe_CWFNG8lcNko1Y-jRTof8S8vTbUCFH-2DjVHKD1POtIWtCfv9hO0H5GcanEH6_csgeRQtd2BDmLTVPXb1bhRWAI-vzc35bVqCLqkXYtGIBHP2ElqRbIyyzf6cZ4YXg0rxmCu22Gf3kEWVKz120yPh7bqmmT5HRk-9B9AisSksEEku.xn6cIdQkzH3rLHgdLQuqgA'}]}, 'splitPnr': None}, '_meta': {'hasUnaccompaniedMinor': False, 'isSwabiz': False}, 'mktg_data': {'air_triptype': 'OW', 'air_bound1_changeairportcode': 'AAA:LAX', 'air_bound2_changeairportcode': 'none', 'air_passengercount': '1', 'air_bound1_changedate': '2024-04-05', 'air_bound2_changedate': 'none', 'air_confirmationnumber': 'XXXXXX', 'pnr_split': '0', 'air_daystotrip': '50'}} [{'departureStatus': None, 'departureStatusType': None, 'arrivalStatus': None, 'arrivalStatusType': None, 'flights': [{'number': '1111', 'wifiOnBoard': True, 'aircraftInfo': {'aircraftType': 'Boeing 737 MAX8', 'numberOfSeats': 175, 'wifiSupported': True}}, {'number': '2222', 'wifiOnBoard': True, 'aircraftInfo': {'aircraftType': 'Boeing 737 MAX8', 'numberOfSeats': 175, 'wifiSupported': True}}], 'travelTime': '5h 35m', 'departureDate': '2024-04-05', 'departureTime': '07:20', 'departureAirport': {'name': 'AAA', 'state': 'AA', 'code': 'AAA', 'country': None}, 'arrivalTime': '16:55', 'arrivalAirport': {'name': 'Los Angeles', 'state': 'CA', 'code': 'LAX', 'country': None}, 'passengerTypeCounts': {'adult': 1}, 'passengers': [{'type': 'Passenger', 'count': 1, 'fareType': 'Wanna Get Away'}], 'boundType': 'DEPARTING', 'standbyFlight': None, 'fareProductDetails': {'label': 'Wanna Get Away', 'fareRulesUrl': 'https://mobile.southwest.com/fare-rules/wanna-get-away', 'fareProductId': 'WGARED'}, 'stops': [{'departureStatus': None, 'departureStatusType': None, 'arrivalStatus': None, 'arrivalStatusType': None, 'airport': {'name': 'xxxxxxxx', 'state': 'XX', 'code': 'XXX', 'country': None}, 'arrivalTime': '02:00', 'departureTime': '11:15', 'changePlanes': True, 'missingAirportDetails': False, 'isOvernight': False, 'isNextDayArrival': False}], 'isNextDayArrival': False}]

@camjones1708
Copy link

I'm hitting this as well and believe it's probably due to a one-way flight. I can make that change to test

@camjones1708
Copy link

I added to the util.make_request
elif response.status_code == 400: logger.debug(response.json())
and received
2024-02-15 15:52:55 DEBUG Process-1[utils:35]: {'code': 400310657, 'message': 'Please select the flight(s) you would like to change', 'messageKey': 'VALIDATION__NO_BOUNDS_TO_CHANGE', 'header': None, 'httpStatusCode': 'BAD_REQUEST', 'requestId': 'no-exp-id:0.eaa2c17.1708030374.67c8751:mweb', 'infoList': [{'key': '', 'value': 'Please select the flight(s) you would like to change'}]}

I haven't had time to go through all the code, but it looks like the URL is correct. Any thoughts?

@jdholtz
Copy link
Owner

jdholtz commented Feb 15, 2024

@camjones1708 I am working on this now. The issue seems to be that the flight number from the fare_type_bounds never matches the parsed flight number in the Flight class, which results in isChangeBound being false in the fare check, hence why you are getting an error that says there are no bounds to change.

It seems like Southwest has been refactoring a lot of their mobile website and this issue is an effect of that. In the response k3vint sent, it seems that the flights are separated by \u200b/\u200b now instead of just /. If you change the following lines in lib/fare_checker.py, does the index error disappear?

--- a/lib/flight.py
+++ b/lib/flight.py
@@ -64,6 +64,6 @@ class Flight:
     def _get_flight_number(self, flights: JSON) -> str:
         flight_number = ""
         for flight in flights:
-            flight_number += flight["number"] + "/"
+            flight_number += flight["number"] + "\u200b/\u200b"
 
-        return flight_number.rstrip("/")
+        return flight_number.rstrip("\u200b/\u200b")

@camjones1708
Copy link

camjones1708 commented Feb 15, 2024

🔥 works like a charm!
Found lower fare of -50 USD for flight

@borski
Copy link

borski commented Feb 15, 2024

"\u200b/\u200b"

This fixed the issue for me as well! :shipit: 🥇

@jdholtz
Copy link
Owner

jdholtz commented Feb 15, 2024

Thanks for testing everyone! This fix is applied in the develop branch/image

@jdholtz jdholtz closed this as completed Feb 15, 2024
@k3vint
Copy link
Author

k3vint commented Feb 16, 2024

awesome.. works again!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants