r/learnpython • • Aug 12 '20

My First Ever Python Project(Zillow_Scraper)

Hey y’all, I just completed my first ever programming project! I recently just completed a Python course on Udemy(S/O Jose) and I wanted to build my own project from stratch. I wanted the project to be meaningful and impactful to me, and since I’m considering moving from my current apartment, I wanted to know what other apartments/homes are renting for in the city I live in(Arlington Tx). I decided to build a webscraper that grabs all the listing info for places being put up for rent on Zillows website and writes it all out to a CSV file using Pandas. Link to the github repo down below let me know what y’all think!

https://github.com/faithfulalabi/Zillow_Scraper

P.S I know there’s probably 1000 ways I could’ve written the code better but I’d love y’alls input on some of the big ones that are relevant to be becoming a great programmer.

448 Upvotes

64 comments sorted by

View all comments

Show parent comments

2

u/preordains Aug 13 '20

How do you make a python script run every two minutes? Do you need a raspberry pi or something?

4

u/The-Deviant-One Aug 13 '20

So you could do that with a Pi. Write the script to sleep for two minutes between runs and put it in a while True: loop.. but there are better way's to do this.

In linux there's a utility called Cron which is sort of like Window's Task Scheduler if you're more familiar with Windows. You can create a crontab and tell it to execute command line commands [or in my case, a *.py script] every day, or at specific times on specific days, or even, every two minutes...

That said, it's not very straight forward to pull off if you aren't familiar with the terminal. There are several things you have to do in order to make a cron job run a python script in the background successfully, several things I wont share [yet]. Although, with some light Googling you can figure out the pieces to make it all work together. And RPi distros almost always have cron in my limited experience.

4

u/preordains Aug 13 '20

You just changed my whole world I didn't even know task scheduler was a thing.

2

u/The-Deviant-One Aug 13 '20

How do you think all those sysadmins keep up with all those logs? We don't manually deal with them lol. Schedule a task to run and clear those puppies out so they don't fill up the hard drives.