![]() |
VOOZH | about |
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
-> schedule: Used to schedule a function to run again after intervals. It is similar to "setInterval" functionality in JavaScript.
-> smptlib: Used to send email using Python.
Below is the implementation of above project:
Output:
Tracking.... Processing: https://www.amazon.in/dp/B077PWK5BT Only 1 left in stock. Tracking.... Processing: https://www.amazon.in/dp/B077PWK5BT Only 1 left in stock. Tracking.... Processing: https://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.