As we know Python is a multi-purpose language and widely used for scripting. Its usage is not just limited to solve complex calculations but also to automate daily life task. Let’s say we want to track any Amazon product availability and grab the deal when the product availability changes and inform the user of availability through email. It will be a great fun to write a Python script for this.
Note: Install the required libraries (as per the code) before running the script. Also, note if the product is not available currently then no email will be sent to user. Asin Id should be provided by the user for the product he wants to keep track of.
Working of each module used:
-> requests: Used to make HTTP get and post requests
-> time: Used to find current time, wait, sleep
-> smptlib: Used to send email using Python.
Below is the implementation of above project:
Tracking.... Processing: http://www.amazon.in/dp/B077PWK5BT Only 1 left in stock. Tracking.... Processing: http://www.amazon.in/dp/B077PWK5BT Only 1 left in stock. Tracking.... Processing: http://www.amazon.in/dp/B077PWK5BT Only 1 left in stock.
Note that the program might throw an error (Critical security alert/Sign-in attempt was blocked) while sending the mail to the user, which can be handled by modifying the security setting in the mail application you are using.
Attention geek! Strengthen your foundations with the Python Programming Foundation Course and learn the basics.
To begin with, your interview preparations Enhance your Data Structures concepts with the Python DS Course. And to begin with your Machine Learning Journey, join the Machine Learning – Basic Level Course