Reading the posts from other people on this platform that participated in the #100DaysOfCode challenge, I decided to join as well. However, I decided not to follow the rules strictly according to https://www.100daysofcode.com/. Instead tweeting everyday I will make a short update every 5 or 6~ish days what my progress is. Furthermore, I am going to do this for 31 days straight instead of 100. Lastly, I am going to try to code every day on a consistent basis but the time coding will vary from a couple of minutes to hours. Still, I find it more important to develop good, healthy habits than forcing myself to do something every day for a hour.
Goal of the challenge
For the first project of Python I decided to build a simple web scraper app. It checks the title and the price of the webscraper and send a notification to your email adress if the price is lower/higher than the condition you have put it.
A very valuable resouce I found was this video of Dev Ed. It explains in detail how to build the project and what each concept is.
For the web scraper I decided to use beautifulsoup.
When I was running the application, I stubled upon a few problems:
- At first the app wasn't able to import the packages of the web scraper. Turnt out I had installed the 32-bit edition instead of the 64 bit. I had to re-install the packages.
- Second, installing the packages itself is completely different compared to installing packages on Linux. I googled the problems and managed to find this thread on Stackoverflow that helped me to figure this problem.
For testing the web scraper I decided to use this product on Amazon DE and made a function which should send me an email if the price drop below 45 euro.
For sending the mail I use the SMTP protocol. SMTP in Python send a message to the SMTP server telling what email to send. You can easily import the smtplib package from Python.
Now after running the application it should display the price, the title and a notification which confirm the email has been sent. And it did!
So far the app works. In the next post I will refactor the code and add other functionalities to the application. I will also read more in Python documentations of certain methods I want to learn more about.
I will keep you guys updated on my process!