Ask coding questions

← Back to all posts
How do I build a Python app that can run once a day for up to 2 hours?
MartinCarlsson2 (0)

Hey

I need some Python code to run once a day for about one or two hours.

The use case is that I'm connecting to an API and moving the result to blob storage (or S3).

It should take between one or two hours to run.

The approach I'm considering is, writing an API with Flask and scheduling with UptimeRobot.

from flask import Flask
import time

app = Flask(
  __name__,
)

@app.route('/')
def index():
  time.sleep(3600)
  return "Hey world"

if __name__ == '__main__':
  app.run(
	host='0.0.0.0',
	debug=True,
	port=8080
  )

However, it looks like UptimeRobot will timeout after 1 minute.

How do I build a Python app that can run once a day for up to 2 hours?

Comments
hotnewtop
Coder100 (18903)

Replit is not meant for reliable hosting, but a way to make your tests public. Use something else, like heroku to accomplish this.

MartinCarlsson2 (0)

@Coder100 are there any easy way to automatically deploy code on heroku from replit?

Kudos (139)

@MartinCarlsson2

You can use Vercel, and whenever you push local changes to Github, Vercel will automatically update the website.

MartinCarlsson2 (0)

@Kudos Thanks! Vercel looks really cool and easy - just what I'm looking for. Unfortunately it is only for node/js and not python