-2

I have written a python script that crawls a website and creates a json response file with the crawled data. Now, I want to use the json response but how do I make sure that the script executes periodically so that the json file is not static but keeps changing as the website which is being crawled changes it data?

Strinzy
  • 41
  • 2
  • 7
  • I'd look at using `cron` if you have it or if you're on Windows without cygwin you could look at `at` or apparently that's been deprecated in favor of `schtasks` – Eric Renouf Nov 28 '15 at 15:23

2 Answers2

-1

I believe you are looking for CRON.

The software utility Cron is a time-based job scheduler in Unix-like computer operating systems.

https://en.wikipedia.org/wiki/Cron

Loïc
  • 11,804
  • 1
  • 31
  • 49
-1
import schedule
import time

def job():
    print("I'm working...")

schedule.every(10).minutes.do(job)
schedule.every().hour.do(job)
schedule.every().day.at("10:30").do(job)

while 1:
    schedule.run_pending()
    time.sleep(1)

How do I get a Cron like scheduler in Python?

Community
  • 1
  • 1
Ricky Wilson
  • 3,187
  • 4
  • 24
  • 29