NEVER have your Python Repls go to sleep again!
What?
You heard that right! This ₜᵢₙᵧ addition to your program allows is it stay alive and running indefinitely.
Why?
I wanted to be able to have my discord bot stay awake without the use of external ping programs.
How?
Using a small flask server and some threaded pinging loops.
How do I get started?
Add the neverSleep.py
file to your project and paste the following code to the top of your main.py
:
import neverSleep neverSleep.awake('YOUR AUTO GENERATED WEBSITE URL')
That's it!
If this gets enough popularity I'll add it to PyPi to make it even easier.
@Rockpods Haha I forgot about this project! Throwback to my high-school days learning Python. Anyways, that's good to know for anyone looking at this project nowadays. I'll do you one better though:
replNeverSleep.awake(f"https://{str(os.environ['REPL_SLUG']).lower()}.{str(os.environ['REPL_OWNER']).lower()}.repl.co", True)
I have tried it 10 minutes ago.
Hope this works!
Keep going!
Very appreciate!!
This is not working for me, just added the nebersleep file, imported it to my main py and used the awake method at the top. Someone got the same issue or know a working solution?
@TobiasKosin Have you made sure to put your program's own url rather than mine?
(The highlighted should be changed with your own code)
Checked today, and this is still operational!
but what about node?
does this still work?? :D
@CoffeeGuy Had to update it but it appears to be working now! ping me here if you need help setting it up.
@c4syner OK :D