Hey there. Welcome to day 39 of 100 Days of Code.
Now,
today we've got a two part series and this is the part
one of your capstone project.
So we've been learning about APIs for quite a while now,
and we're going to be using a combination of different APIs to create a cheap
flight finder. Part one,
our program is going to find amazing flight deals just for ourselves.
And in part two,
we turn this project into a fully-fledged product where we can start signing up
users to use our service. So I don't know about you,
but I am a travel aficionado.
I absolutely love to travel.
I'm the sort of person who can't stay stationary in one location.
And one of the reasons why I teach Programming online is to be able to travel
and work from different places.
Now I'm not that picky about where I go. I think everywhere I go,
there's beautiful people who can teach me a lot of things.
So instead of planning a trip where I have one destination and I plan out the
time and date, I actually just look for a good deal.
So when I can get a flight
that's really cheap and it's to a location that I want to visit,
then I pretty much just go for it. So for example,
whereas a flight to New Zealand normally costs something like 800 pounds,
I managed to get a flight for just a 350 pounds,
and it was such a good deal.
It even included a stopover in Beijing where I was able to get some tasty duck
before I went onto the next 12-hour flight. Another case, um,
was Japan where the flight normally costs around 500,
550. And I managed to find a flight that was just a 250 pounds return.
And the savings on the flight meant that I got to eat some extra tasty sushi.
The way that these deals come about is imagine if you go onto a flight search
website and you look for flights,
anytime in the next six months,
every day for lots of different locations.
Then you will see that at some point,
one of the flight prices will come up and it's much lower than what you expect
it to be. And that's how you get a good deal. But of course,
we're too busy to do that every single day manually.
So here's how my program works. First,
we have a Google sheet which keeps track of the locations that we want to visit
and a price cutoff. So a historical low price.
For example,
maybe I want to go to Kerala and visit Kotchi and eat some tasty South Indian
food. Well,
maybe I would set the price at 350 pounds return from London.
So we take this data from our Google sheet with lots of different locations
and their lowest prices and we feed that into a flight search API,
which is going to run every day, searching through all of the locations
looking for the cheapest flight in the next six months.
When it comes up with a hit and it finds a flight that's actually cheaper than
our predefined price,
then it's going to send that date and price via our Twilio SMS module to our
mobile phone so that we can book it right there
and then. That's the theory of it, but let's see it in action.
So here I've got the code for my personal flight club and I'm going to run it
and we're going to watch my phone and wait to see if there were any good deals
that they found today.
And we get a text message from our Twilio account and there we have it. Today's
message says low price alert,
only 41 pounds to fly from London Stansted to Berlin from the 25th of August to
the 10th of September.
That was triggered because it looked at my spreadsheet of flight prices and it
found that out of all of these locations,
the only flight that it found which was cheaper than my lowest price was
for Berlin. It was actually only one pound cheaper.
So now that I've got my message, I can go ahead and book my trip to Berlin.
But before I do that, we're going to complete this capstone project.
So head over to the next lesson and let's get started building this project.