How about an “API” for Southwest Airlines

If you fly southwest, you probably know that you can only book their official website, not through a third party. This makes the booking kinda painful. When I fly, I usually use Google Flight’s powerful filters and gadgets to help me narrow down to the most desirable flights. On southwest, it’s kind of a brute force effort.

Worry no more! My python package called scrapeswa can help you get all the useful information about your next trip in one command.

I realized that Southwest’s website is actually very scrapable. The site doesn’t contain CAPTCHA challenges nor anti-scraping features. The caveat is that it’s built on react.js, so it requires more than a simple HTTP request to get the info you need. To solve that, I made use of the handy Selenium automation framework +¬† headless Chrome Web Driver, essentially mocking a real chrome window to render the page with JS except not actually using chrome. The scraping effort is rather slow, unfortunately, because your machine literally has to render the entire application from scrach. If you are using a decent rig with good internet, you should be able to scrap one roundtrip query within 3 seconds.

Details on the usage of this library are available on my GitHub repo. This tool is simply a mock “API”. I will write about my motivation behind building this tool after I finish my intended application based on this tool.

Happy hacking!