Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to run a python script at a specific time(s)

Tags:

python

I'd like to write a simple python script for doing a specific job. I'm getting some time and link information from a web site.

times=
[
('17.04.2011', '06:41:44', 'abc.php?xxx'),
('17.04.2011', '07:21:31', 'abc.php?yyy'),
('17.04.2011', '07:33:04', 'abc.php?zzz'),
('17.04.2011', '07:41:23', 'abc.php?www'),]

What is the best way to click these links at the right time? Do I need to calculate the time interval between the current and the one in list and sleep for a while?

I'm really stuck at this point and open to any ideas which could be useful.

like image 969
Fish Avatar asked Apr 15 '11 13:04

Fish


People also ask

How do I run a Python code at a specific time?

' in the Actions Tab. And give a suitable Name and Description of your task that you want to Automate and click on Next. Step 3: In the next step, you have to select at what time intervals your script should be executed. Select 'Daily' and click Next.

How do I run a code at a specific time?

You can use perform(_:with:afterDelay:) to run a method after a certain number of seconds have passed, but if you want to run code at a specific time – say at exactly 4pm – then you should use Timer instead.

How do I schedule a Python script online?

Go to your Dashboard and then to Files and then to the Upload a File button and upload the Python file you want to schedule for execution. Go to Tasks and set the time (in UTC) of the day that you want your script to be executed and type in the name of the Python file you uploaded (e.g., myscript.py).


1 Answers

Take a look at Python's sched module.

like image 70
Mark Dickinson Avatar answered Sep 21 '22 13:09

Mark Dickinson