This simple Python script acts like a cron job, visiting a specified URL at a user-defined time interval:

import time

import requests


def visit_url(url, interval):

    while True:

        response = requests.get(url)

        print(f"Visited {url} at {time.ctime()}")

        time.sleep(interval * 60)  # Convert minutes to seconds


if __name__ == '__main__':

    url = input("Enter the URL to visit: ")

    interval = int(input("Enter the time interval (in minutes): "))

    visit_url(url, interval)


To run this script:

  1. Make sure you have the requests library installed. You can install it by running pip install requests in your terminal.
  2. Copy the script into a Python file (e.g.,
  3. Execute the script by running python in your terminal.

The script will prompt you to enter the URL you want to visit and the time interval (in minutes). It will then repeatedly visit the specified URL every interval minutes and display a message indicating the time of the visit.

Please note that this script will run indefinitely until you manually stop it (e.g., by pressing Ctrl+C).