xur17 / southwest-alerts

MIT License
67 stars 22 forks source link

Domestic, Points and Single Traveler Reservations Only #1

Open wacheena opened 6 years ago

wacheena commented 6 years ago

FWIW (and to inform other /r/churning visitors) it looks like this project only works with domestic rewards using rapid rewards points for a single traveler.

If I have some time over the holidays I might take a crack at adding support.

xur17 commented 6 years ago

I'd love to have another set of eyes on this - I don't have a good way to fix it for international or companion pass bookings unfortunately without booking one myself.

On Wed, Nov 22, 2017, 15:21 Loren Donelson notifications@github.com wrote:

FWIW (and to inform other /r/churning visitors) it looks like this project only works with domestic rewards using rapid rewards points for a single traveler.

If I have some time over the holidays I might take a crack at adding support.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/xur17/southwest-alerts/issues/1, or mute the thread https://github.com/notifications/unsubscribe-auth/ACPQq8PnmwhDGHNbnvo92JIyFiZ0hWGKks5s5IJfgaJpZM4Qn9DU .

joshjohanning commented 6 years ago

Does anyone have any idea why international fares aren't supported?

hildebrau commented 6 years ago

I have a domestic fare with two travellers booked with points and it keeps telling me of a point reduction. However when I look, the price hasn't changed. A few times it had lowered though. But then it has alerted each time since without it lowering further.

How do we debug this container's script? I can't figure out how to run the container without it executing and exiting very fast. I'd like to shell into it and monitor it's execution in debug mode or something.

Is what I'm experiencing the known issue of multiple travelers? I also have some bookings with companion pass travelers applied. Maybe I can help with that issue, too, if it's really a problem. It must error silently, if it is erring.

Thanks!

hildebrau commented 5 years ago

I have a single traveler confirmation number using points. I had a companion attached to it and it was telling me of a price drop for 5354 points. I removed the companion and checked and saw that there was, in fact, NO price drop (or raise). I ran the script again while the companion was not attached and it said the exact same thing bout the 5354 point drop.

It's highly annoying to get this false information alerted to me each time this scheduled script runs. How can we debug the issue? I'd love to step through the script in some way to help make this a more solid alert mechanism.

Thank you!

joshjohanning commented 5 years ago

@hildebrau And this isn't a sold out flight or anything, right? The only time I got a price drop email mistakenly was when the flight gets sold out. I submit my logic for handling of a sold out flight in PR here: https://github.com/xur17/southwest-alerts/pull/11

If you know a little bit of python, you can access the Docker container files directly. For example, on my ubuntu machine this is located here: /var/lib/docker/overlay2/4eff11ff0a7a1b560055bdeefb87bb8a38211511f7a98e12c185bc11ad9db7ce/diff/app/southwestalerts

You will have to do some digging on the exact guid for your instance. Good luck and report back.

hildebrau commented 5 years ago

Thanks. I'll check out the Python code.

And no, it's not sold out.

hildebrau commented 5 years ago

Unfortunately, all I can find in there are .pyc files, which I assume are compiled python code.

hildebrau commented 5 years ago

I did a git clone of the repo, and ran it manually outside of the container to debug.

I added a couple of logging lines: logging.info('original price: %s',itinerary_price)

            logging.info('current detected price: %s',matching_flight['fares'][0]['price'])

When I run it, it shows this:

INFO:root:original price: 22027 INFO:root:current detected price: {u'amount': u'16,673', u'currencyCode': u'PTS', u'currencySymbol': None} INFO:root:current detected price: None sold out INFO:root:Price drop of 5354 points detected for flight

So, it looks like it could be related to the "sold out" code.

In another instance, it output this: INFO:root:original price: 23147 INFO:root:current detected price: {u'amount': u'6,603', u'currencyCode': u'PTS', u'currencySymbol': None} INFO:root:current detected price: {u'amount': u'11,320', u'currencyCode': u'PTS', u'currencySymbol': None} INFO:root:Price drop of 5224 points detected for flight REMOVED from CLT to AUS on 2019-02-18 INFO:root:Sending email for price drop

The itinerary included AUS->CLT->AUS. However it was reporting the drop on the CLT->AUS leg. This was confusing, as the drop was actually on the AUS->CLT leg. Once I realized that, I was able to save 5224 points; so that was nice.

hildebrau commented 5 years ago

Well, I took a stab at this. I'm not really a developer; and never coded in Python before; but I think I did an alright job at this. Sadly, I haven't mastered "git" to pull/push in order to submit my changes. I will try to figure that out.

Here. Maybe I figured it out:

13

joshjohanning commented 5 years ago

For the Docker thing, maybe you just have the wrong folder b/c I have my .py files in there. But yeah running manually also works.

Ohh, so what you're saying is a particular class is sold out, but not the entire flight.

I also made changes regarding better handling of the sold out stuff, but not for your particular scenario. If your code works as expected I can scrap this PR then: https://github.com/xur17/southwest-alerts/pull/11

Unfortunately I just took my sold out flight over this past weekend so I no longer have a good test case.

I pulled in your code manually to my environment and it seems functional, I just don't have a good test case for it at the moment.

hildebrau commented 5 years ago

How did you pull in my code to your docker container? I use docker-compose.yml files to build my containers locally. I can't figure out how to tell it to use my change, though. Silly me.

hildebrau commented 5 years ago

I believe that an entirely sold out flight will probably not work out with my code changes. I'll have to think about that more. My version will currently handle a fare type being sold out, though.

joshjohanning commented 5 years ago

I must have had better luck in finding my docker container files than you did :s Perhaps you can run a search under here for *.py files? /var/lib/docker/overlay2/

I only ever had one flight that was completely sold out, but this is what I did (the part I changed is in the if/elif. The elif check is in the current code in master branch, but not the if.

                # Find that the flight that matches the purchased flight
                matching_flight = next(f for f in available['flightShoppingPage']['outboundPage']['cards'] if f['departureTime'] == departure_time and f['arrivalTime'] == arrival_time)
                # Check to make sure the flight isnt sold out to avoid NoneType object is not subscriptable error
                if matching_flight['fares'] is None:
                    print("sold out")
                    matching_flight_price = 0
                elif matching_flight['fares'][0]['price'] is None:
                    print("sold out")
                    matching_flight_price = 0
                else:
                    matching_flight_price = locale.atoi(matching_flight['fares'][0]['price']['amount'])
xur17 commented 5 years ago

FYI - if you are trying to modify some of the py files associated with the docker image, I recommend building an image locally rather than trying to modify the existing image locally.

If you have docker installed you just need to clone this repository, and run the following in the cloned directory after modifying any files you wish to modify:

docker build -t my-southwest-alerts .

Then just run the docker run command with the image name you specified above (my-southwest-alerts in this case):

docker run -e MAILGUN_DOMAIN=??? -e MAILGUN_API_KEY=??? -e USERNAME1=SOUTHWEST_USERNAME -e PASSWORD1=SOUTHWEST_PASSWORD -e EMAIL1=NOTIFICATION_EMAIL my-southwest-alerts