Makes creating a server to be pinged easier
Project description
██████╗ ██╗███╗ ██╗ ██████╗ ███████╗███████╗██████╗ ██╗ ██╗███████╗██████╗ ██╔══██╗██║████╗ ██║██╔════╝ ██╔════╝██╔════╝██╔══██╗██║ ██║██╔════╝██╔══██╗ ██████╔╝██║██╔██╗ ██║██║ ███╗ ███████╗█████╗ ██████╔╝██║ ██║█████╗ ██████╔╝ ██╔═══╝ ██║██║╚██╗██║██║ ██║ ╚════██║██╔══╝ ██╔══██╗╚██╗ ██╔╝██╔══╝ ██╔══██╗ ██║ ██║██║ ╚████║╚██████╔╝ ███████║███████╗██║ ██║ ╚████╔╝ ███████╗██║ ██║ ╚═╝ ╚═╝╚═╝ ╚═══╝ ╚═════╝ ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚══════╝╚═╝ ╚═╝ built by @Necrownyx
PingServer
PingServer is a python package that makes things more convenient to set up a server to be pinged by uptimerobot.com this package is most useful on sites like replit.com where your program might shut down after being idle for too long
Usage
First import the package with:
pip install PingServer
Then import it with:
import PingServer
Then add this one line to start the server:
PingServer.start()
The start()
command has an optional parameter for a message on the web page to be pinged.
How to run on a thread.
If you want to run the server on its own thread you can put this in your code:
PingServer.thread().start()
This module of the package can also take a custom message for example:
PingServer.thread("hello, world!").start()
Will output "hello, world!" on the webpage.
How to serve multiple pages.
If you want to serve multiple different pages first create the page use either:
PingServer.create_page(route, message)
with route
being the route of the site for example: '/'
and message
being the message to be served to users or a html file name for example index.html
this file must be in the templates directory of your project.
You can loop through this as many times as you want.
Then when you have defined all of the pages for your site run:
PingServer.launch_pages().start()
To run all the sites on a thread or:
PingServer.launch_pages_nothread()
To run the sites on the main thread.
Background.
This is the first python package I have ever made and is somewhat of a tutorial for myself with something I will be able to use for things like discord bots on replit.com and more.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for PingServer-0.0.32-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | adaa24670fc05c3751850dd025a87ed8551c9ad2e34db748556aadcd5385f99f |
|
MD5 | eec65e1d1560ece6b54ef076184aebff |
|
BLAKE2b-256 | 29138b7bc1a385c25fff3f2fe2faf4e71ed4aa418f00d5a1efab000677a43592 |