Search code examples
pythonservercloud

How to easily and cheaply run a simply python script every 5 mins for a whole week - day and night?


I want to run a very simple python script (or any language) which collects data from an api at regular 5 minute intervals and saves the data. I need this process to run for a whole week - day and night. I can't keep my laptop on all week so I guess I will need this to run on some kind of server.

What is the cheapest and easiest way for me to do something like this? This is an incredibly simple script so I don't want to spend ages setting up a complicated server which is ultimately overkill for a task like this.

Pseudocode:

# Every 5 minutes for a whole week:

data = call_api(url)
write_csv(data)

Solution

  • You're going to need a cloud server as it's the cheapest option if u can't setup a system at home. I'll 2nd what furas said about pythonanywhere.com. I use their $5 a month plan to run simple tasks like this. You can cancel anytime so if it's just 1 week then you pay $5 for your account, that's it.

    There is no messing around with setup either, just upload your main.py and schedule as task in the dashboard.