How few lines of code helped me in booking IMAX ticket for Avengers Endgame

Satish Gupta
3 min readMay 6, 2019

I still remembered when I first watched Iron Man on TV. A few minutes after that, I became a huge fan of Tony Stark. From then to now, the only superhero I admire is Tony. We love you 3000!!

Avengers Endgame released on 26th April 2019, and I was not able to book a ticket to my nearest IMAX. So I thought of booking my ticket for 1st May. But I noticed that the tickets were getting sold quickly. So, I had to do something such that I come to know when the booking starts for 1st May for a specific theatre.

To solve this problem I wrote a few lines of python code.

Problem Statement: Write code to notify whenever the booking starts for a specific day and for a specific venue.

To solve this problem, I went step by step. So this was my plan.

  • Figure out the URL to fetch the booking details for a particular day.

This was simple, I just had to look for the Url from Bookmyshow.
For eg. https://in.bookmyshow.com/buytickets/avengers-endgame-bengaluru/movie-bang-ET00100668-MT/20190501

  • Figure out how to make GET request from python.

I just googled for this and got to know about the requests library.

  • Parse the Html content to dig information regarding the theatre names

Again, I googled and found the BeautifulSoup library for python.

  • After getting the theatre names, I just checked whether it contains my preferred theatre name or not. That simple.

But, I had to figure out some way to notify myself that the ticket booking had started.

There are two case

  1. I will be using my laptop
  2. I won’t be using my laptop.

To solve the first situation what I thought was to send notifications to my laptop from the code regarding the jackpot. So I googled and got to know about the PYNC library for python. Using this library I was able to push notification to my laptop.

To solve the second situation what I thought was to send Text-SMS to my phone Number. I did some POC and came to this wonderful site https://www.fast2sms.com/. This site allows you to send a text message to any phone number. So I googled how to use this in my python code. And added this feature too.

This actually solved my problems. But, all the messages which can be sent using this site are categorized into Promotional SMS. In India, Promotional Messages get delivered only between 9 AM to 9 PM. So what if tickets booking starts after 9 PM and I am not using my laptop?

To solve this situation I thought of sending e-mail to my mail Id regarding the Jackpot.

Though I couldn’t implement the email part as I was running out of time. But I added the notification and SMS part.

And one fine Day, I got this message. (Ignore the first message 😐)

With this, I was able to book a ticket at my preferred theatre along with options to choose the best sits. 😆

And yeah, All this just to see Tony dying 😢.

Anyway,

This is my first story. I believe currently I am not a good writer but wanted to share this story. Sorry for any grammatical mistake 😐

  • Satish Gupta

--

--