Skip to content
This repository was archived by the owner on Jun 13, 2023. It is now read-only.

Commit 064a834

Browse files
authored
Add files via upload
1 parent edeac5a commit 064a834

6 files changed

+253
-0
lines changed

Pinger.py

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
from os import system
2+
import socket
3+
from time import sleep
4+
import json
5+
import httpx as requests
6+
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
7+
8+
def ping(website=None):
9+
try:
10+
requests.get("https://"+website)
11+
return True
12+
except:
13+
try:
14+
requests.get("http://"+website)
15+
return True
16+
except:
17+
try:
18+
requests.get(website)
19+
return True
20+
except:
21+
return False
22+
23+
sites = ['']#Put websites to monitor here. For putting multiple sites, use this format 'website1','website2','website3'
24+
25+
while True:
26+
status = '\n'
27+
for site in sites:
28+
output = ping(site)
29+
if output == True:
30+
status = status + f'{site} is up\n'
31+
else:
32+
status = status + f'{site} is down\n'
33+
print(f'{status}\n')
34+
sleep(10)

keepalive.py

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
from flask import Flask
2+
3+
app = Flask(__name__)
4+
@app.route("/")
5+
def keep_alive():
6+
return "This is so i can keep the bot running when I close the Repl"
7+
8+
if __name__ == "__main__":
9+
app.run(host='0.0.0.0')

main.py

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
from os import system as bash
2+
bash('python3 keepalive.py & python3 Pinger.py')

poetry.lock

+191
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
[tool.poetry]
2+
name = "Pinger"
3+
version = "0.1.0"
4+
description = "A simple pinger using Repl.it db!"
5+
authors = ["Navaneeth K M"]
6+
7+
[tool.poetry.dependencies]
8+
python = "^3.7"
9+
flask = "^1.1"
10+
httpx = "^0.11.1"
11+
12+
[tool.poetry.dev-dependencies]
13+
14+
[build-system]
15+
requires = ["poetry>=0.12"]
16+
build-backend = "poetry.masonry.api"

requirements.txt

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
flask

0 commit comments

Comments
 (0)