Python Run 24/7 Plan Hacker

My code is working, but it stop after few minutes, in my code have an infinite loop.
I have the Plan Hacker and I cant see the option Always On in my Reply
For my code I need the Asias’s Server and when I tried deployment its not work because the server is USA

How can leave my code Run 24/7?

import requests
import time
from datetime import datetime, timedelta

intervalo = 2

data = requests.get('https://blaze-1.com/api/roulette_games/history?startDate=2023-08-10T23:16:17.410Z&endDate=2024-09-09T23:16:17.414Z&page=1').json()
data = data ['records']
id = (data[0]['id'])
totaldata = len (data)
print(totaldata)

def arrumarDataHora(datacompleta):
    dataPedra = datacompleta.split("T")
    HoraSemMilessimo = dataPedra[1].split(".")
    datacerta = datetime.strptime(f"{dataPedra[0]} {HoraSemMilessimo[0]}", '%Y-%m-%d %H:%M:%S')
    datacerta = datacerta - timedelta(hours=3)
    return datacerta

contador = 1
while contador > 0 :
    data = requests.get('https://blaze-1.com/api/roulette_games/history?startDate=2023-08-10T23:16:17.410Z&endDate=2024-09-09T23:16:17.414Z&page=1').json()
    data = data ['records']
    id_new = (data[0]['id'])

    if id==id_new:
        intervalo = 2
    elif id==data[1]['id']:
        id = (data[0]['id'])
        created = (data[0]['created_at'])
        roll = (data[0]['roll'])
        datacerta = arrumarDataHora(created)
        print(f'{id}')
        print(f'{roll}')
        print(f'{datacerta}')
        intervalo = 26
            
    time.sleep(intervalo) 

Hi @WilliamRodrig50 , welcome to the forums!
Always-On is being replaced with Autoscale Deployments.
Read more here:
https://docs.replit.com/hosting/deployments/autoscale-deployments
and:
https://blog.replit.com/autoscale

If this answers your question, you can mark this post as a Solution.

No my friend,
The problem continues, when I try the use deployments return error in line 26 because the Api is blocked in USA.
To run my code I need the Asian’s server and I don’t know how to change server in Deployment.
In Replys is possible chagen the server

See this topic for information about Always on that may answer that question.

I don’t either. I don’t have enough cycles to keep a deployment running.

1 Like

Hey @WilliamRodrig50!

I have asked the team if it is possible to change the region of a Deployment and will follow up once I know more!

3 Likes

This answer isn’t really about how to make your repl always on, but after your hacker plan expires, i would invest in a raspberry pi because you have full access to everything on it, you can make it run 24/7, it would work way faster(depending on which one you get) and the raspberry pi can be used for other things(also the electricity cost is close to none)

2 Likes

Ty my friend, I don’t know what do.
I need chagne the refion of a Deployment urgently.
When you know please inform me

Nice tip my friend but do you know if this raspberry pi has server in Asian?

Raspberry Pi is a microcomputer brand. You buy a physical tiny computer and do whatever you want with it, in this case, host a project to the internet. So, it’s a server in Asia if you buy one and set it up in your home in Asia.

What is being blocked by the API? Is it the IP of the Deployment?

1 Like

I using requests and the url is blocked for some IPs

1 Like

Thank you for explanation, but this Raspberry Pi doesn’t solve my problem

1 Like