-
Notifications
You must be signed in to change notification settings - Fork 22
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
429 error #16
Comments
Also was playing around with the API and have no idea how to fix. I think the request headers have changed. For example, I think the API_KEY has changed from |
Changing the API key around makes it fail in a different way. The mobile southwest site now uses a /v2 oauth-endpoint. There's some headers that seem to be required, that I'm not sure where they come from: X-5Ku220Jw-a (which is really giant), X-5Ku220Jw-b, X-5Ku220Jw-c, X-5Ku220Jw-d, X-5Ku220Jw-uniqueStateKey... removing these from the request my browser made gives a BAD_REQUEST response. The current mobile site seems to be "non-standard" HTML with no real 'buttons' and 'links' but naviagation areas that are tappable/clickable. This might make it harder to write a different sort of scraper. |
https://github.com/byalextran/luvwrapper seems to have gotten around this. I'm not much of a programmer but it appears they are submitting a JSON request rather than an HTML request and then parsing the results? |
luvwrapper doesn't run into problems because it never tries to hit the Perhaps it might be easier to even write a beautiful soup / selenium webdriver based scraper. |
luvwrapper likely does similar things as this software, and based on its last updated dates, I wouldn't be surprised if that also was broken by this change. Re: selenium based scraper, I was thinking along those lines, hence my mention of "non-standard HTML" -- this might be part of some anti-scraping code to keep the OTAs and such out, in which case it would also be more difficult for us. |
Selenium isn't working now either... seems they are checking for selenium related variables or something and it fails to process the request |
So, catch me up. Does this script work at all for anyone? Is there a new solution for doing personal price checks (other than manually)? I guess this container I was running stopped working a long time ago. ;( Thanks! |
@hildebrau , no, believe it is giving 400 errors to everyone since Southwest changed some of their api's. |
I paid a reddit developer to update this script and have it working. Going to wait a few days and make sure it still works (we are also working on adding functionality to it -- international itens are def not going to work but it should be able to scan for flights paid with dollars. @xur17 are you alive and/or still interested in continuing development? |
Can you point us to your fork when you get the changes merged in? I expect many others will be interested in how this problem was solved. Thanks! |
Nice! Looking forward to trying it out!
…On Wed, Jul 17, 2019, 6:28 PM hoopsbwc34 ***@***.***> wrote:
I paid a reddit developer to update this script and have it working. Going
to wait a few days and make sure it still works (we are also working on
adding functionality to it -- international itens are def not going to work
but it should be able to scan for flights paid with dollars.
@xur17 <https://github.com/xur17> are you alive and/or still interested
in continuing development?
Can you point us to your fork when you get the changes merged in? I expect
many others will be interested in how this problem was solved. Thanks!
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#16?email_source=notifications&email_token=AAUHSPJCSORK7XYVAPX4WV3P76TJFA5CNFSM4G4WZAGKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD2G34GQ#issuecomment-512605722>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAUHSPJM3ZVNPTHT54CUNETP76TJFANCNFSM4G4WZAGA>
.
|
Seems like Southwest is really cracking down on this stuff. I was digging into the web interface to see if there is a way to mimic their authentication API calls on the web, but it appears it too is executing a crap ton of Javascript to create secret request headers. Anyone able to decipher swa-common.js? |
http://jsnice.org/ does a fine job of deobfuscating this code (not that it makes any sense to me.) The headers that are required are not being computed or generated in code -- they appear to be static -- but they are being changed every few days. I still haven't figured out where they are coming from but I am getting closer to converting this script to use pyppeteer to launch headless chrome to pull the required headers at the beginning of each session. |
Alright everyone, my script is now running in python (I'll try to find time to test if the docker library can be built, will probably have to add some chromium dependencies but we will see.) https://github.com/Fffrank/southwest-alerts Anyone care to test it out? Still doesn't work for international fares but does a much better job picking up paid fares in addition to award fares. I've tested it with several bookings both with and w/o companion's booked and it seems to work. Feel free to drop me feedback over on that repo. |
Docker now works correctly, too -- docker pull fffrank/southwest-alerts |
@Fffrank , I just tried it out. It looks super promising, but it is throwing some tracebacks.
In this case XXXXXD is a flight from AUS to HNL on 12/20, and all available flights for that route and day are in the SOLD OUT status. That may require some extra logic that the script is mishandling. |
I'm also seeing some 429 responses, which I think means we're hitting their site too quickly. The line numbers may be off a bit, as I've been adding some debug logging.
|
429 has generally meant there's a header missing (I've tried adding in 10 second delays and it still errors out occasionally.) I haven't figured out exactly what's causing it because it's not repeatable on my end. The first issue is indeed because the flight is sold out across all booking buckets. Should be an easy fix (but a difficult test on my end since I don't have a booking with that problem (and it's hard to create one that's sold out!) I've tried to fix it -- want to try pulling and running fffrank/southwest-alerts-test via docker |
I ran it, and I'm getting a larger output. I feel like it's having a different problem. Here is the error I saw. I'll try it a few more times afterwards, so keep scrolling.
Yep. I ran it again, and it ended in this way. I didn't notice any different output w/ your -test version. Did I do something wrong?
I understand the difficulty in testing for a sold out test case. I'm happy to run whatever you throw at me to debug this one to death. It'll be on my account until Dec 20th. ;) Obviously sooner the better on a fix though! |
The first error happens when the browser fails to login. Sometimes southwest just stalls and spins the loading icon on the login page (and I haven't figured out a way to detect/retry this.) The second error seems exactly the same as before which is puzzling. I can add a debug line that will dump the relevant dictionary/variables and you can send them to me (you may just need to spend some time to scrub your personal info.) Would that work? I probably won't have any time to work on this until Monday so it's good thing you're not in a huge hurry. ;) |
That will work. I tried to log some debug info; but failed when I kept hitting the 429 error in the same docker container session after a while. I felt like 429 translated to "you're hitting us too often, so chill out". I ran bash inside the container, and installed vim via apt-get so I could edit. But once I saved changes, it seemed that I had to run the script within that container. If I started the container with docker again, it didn't seem to see my changes. I'm still a docker newb though; so I'm not sure what to expect in that scenario. Anyway, I'm happy to help and happy to have help. I can certainly scrub the output as needed. |
Right -- docker containers are built on "images" and this one doesn't have any external volumes (so outside of logging, it's really kind of on an island.) You're braver than I am if you're using vim, though -- I'm a medium newb at docker and python and open up vim and can't figure out how to exit fast enough. |
Oh. hah. vim is an appendage to me. I don't have to even think when I'm using it. But I get where you're coming from. hah. |
@hildebrau I updated the fffrank/southwest-alerts-test image to log many more details. If you want to put it in a pastebin or a gist I'd be happy to look at it and see if I can fix your error. |
@Fffrank sorry for the delay. I finally had some time to try this one out. Debug output is here: https://gist.github.com/hildebrau/8e9e897f64979b05df40d6fce459a717 I fear it's crapping out before a useful debug output on that last record locator. But you tell me. |
@hildebrau You're correct but you leaving the URL at the bottom seemed like a big help. I've updated the script (kind of shooting in the dark here) But feel free to do a new docker pull and see if I've fixed it. ;) |
@Fffrank here is the new debug. Definitely closer! https://gist.github.com/hildebrau/579827321a4a77dd937fe184e46d6a43 |
@hildebrau I'm going to consider that fixed except for my crappy python syntax! I'm confident that I can easily fix the logging error. Harder is why it looped back to the first confirmation number a second time..... Your paste isn't two executions, is it?? |
It's one execution.. but I think it found another sold out flight perhaps.. (hawaii over Christmas time..) |
@hildrebrau Give it another shot. Fingers crossed that fixes it! And if anyone else can find anywhere on the southwest site or via API where it lists how many points/dollars you've paid for an international flight that is one feature that I would LOVE to add (but haven't found anywhere except the original booking email -- but I could add a command line feature to manually include that flight w/ the confirmation number. I'm thinking on it.) |
@Fffrank it got rid of the nasty parse errors! this time it ran through my wife's account too, and it failed on something. Maybe it just failed to get a proper API key on that run through? https://gist.github.com/hildebrau/dfea0175fb305a0b568cd572a75c3277 I'd steer clear of command line options since we run this as a docker container mostly.. environment variables perhaps? I don't have any SWA international flights to test with. Sorry! Nor the points to buy one. ;( |
@hildebrau Cool! I pushed those testing changes into the master branch so you can switch back to the main docker if you'd like. I'll experiment with some logic to make sure that the headers are properly generated before it moves on. That's def the problem with your second run (I have that issue about 5% of the time but it seems to come and go.) Shouldn't be that hard of a fix but it is difficult to test since it's not easily repeatable. |
@Fffrank, could you tell me how I can enable debug messages that could help determine why my flights that are booked through my work's travel agency software are showing as $239 drop. The reservations can't be changed via the Southwest website. It shows a message about having to call in to make a change. Ever since I added my rapid rewards number to these itineraries, I get alerts from this script about huge price drops. |
@Fffrank does your script work for just checking prices? As in, first log in then call |
@hildebrau As I'm sure you've noticed the script is broken again and I can't seem to get it to work. If you'd like a go at debugging it, it's probably easiest at this point if you install pycharms and set breakpoints to try and debug. It has a great way you can mark/watch variables. I had never used it before this project and somehow made it work (however briefly.) @Weizilla Does not have that functionality but would be relatively easy to implement (if I had the desire to do so and if the script was currently functional.) |
@Fffrank Sounds good. I wasn't looking for whole app to handle that use case, just confirming that the relevant parts in |
Still keep running into 429 error. Just submitted a new issue here: #17 (comment) |
If anyone is lurking here -- I have updated my test branch and it's currently working again for me. Feel free to try it out and let me know? Would like one more confirmation before I merge it and push a new docker image. |
I'm lurking. I was going to try to test it out; but I don't have any scheduled flights. My companion pass expired, so I think I'm done having a ton of SWA flights scheduled. ;( I will give it a shot to see if it can at least log in and see that I have no flights to search for in a clean fashion. I need to wait for my bad password attempts to expire, though. |
@Fffrank , I tested it and it threw some errors.. mind you, I don't have any flights reserved at the moment. https://pastebin.com/5FiRP9GW |
Update. I think as long as I wait for the login cookie to expire it runs
fine. Trying to run the script back to back brings 429 errors immediately.
I still get random 429 errors but it’s once in every 5 or 10 times I run it
now. Might be worth some retry logic in the future on 429 rather than
killing the script.
Also added texting through twilio and config file based setting of
variables instead of using environment variables (just a personal
preference).
Thanks!
…On Sat, Jan 11, 2020 at 6:00 PM hildebrau - ***@***.*** ***@***.***> wrote:
@Fffrank <https://github.com/Fffrank> , I tested it and it threw some
errors.. mind you, I don't have any flights reserved at the moment.
https://pastebin.com/5FiRP9GW
Thanks for keeping at this! Much appreciated!
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#16?email_source=notifications&email_token=ABZ4Z3Q2WG4XHDGMW57DFPTQ5JTTRA5CNFSM4G4WZAGKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEIWOYZA#issuecomment-573369444>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABZ4Z3RKANI6ADVBU4J52ULQ5JTTRANCNFSM4G4WZAGA>
.
|
Guessing southwest changed something with their API?
The text was updated successfully, but these errors were encountered: