Automatically download the file from server in every 24 hrs

Viewed 192

I want my program to download the file from the server automatically with out any input value,

My program ask for the user input of start and end date but I want my program to download the file in every 24hrs.

import urllib.request

import json

import pandas as pd

start_date = input("Enter the Start date in (format: DD-MM-YEAR): ")

end_date = input("Enter the End date (format: DD-MM-YEAR): ")
link = 'https://np02-slow-control.web.ch/np02-slow-control/app/php-db-conn/histogramrange.conn.php?elemId='+ variable_ID + '&start=' + start_date + '&end=' + end_date
1 Answers

You may use a Task Scheduler which is a Windows default app.

  1. Run the Task scheduler and select 'create a task'
  2. In the 'trigger' tab, you can choose what time the script should run.
  3. In the 'action' tab, you have to enter the command which runs a python script such as 'C:\Program Files\Python39\python.exc C:\Users\Documents\myscript.py'

You may also refer to this webpage: https://www.geeksforgeeks.org/schedule-a-python-script-to-run-daily/

Related