aboutsummaryrefslogtreecommitdiff
path: root/index.py
diff options
context:
space:
mode:
authorNeodarZ <neodarz@neodarz.ovh>2016-09-23 16:19:19 +0200
committerNeodarZ <neodarz@neodarz.ovh>2016-09-23 16:19:19 +0200
commit6f69e7c3d06cacc654afa71c721c171421ed005d (patch)
tree5aec735e2fd59b2a758d01525118e31e0f4239eb /index.py
downloadweb_checker-6f69e7c3d06cacc654afa71c721c171421ed005d.tar.xz
web_checker-6f69e7c3d06cacc654afa71c721c171421ed005d.zip
First commit
Diffstat (limited to '')
-rwxr-xr-xindex.py36
1 files changed, 36 insertions, 0 deletions
diff --git a/index.py b/index.py
new file mode 100755
index 0000000..cf8dd15
--- /dev/null
+++ b/index.py
@@ -0,0 +1,36 @@
+#!/usr/bin/python3
+# -*- coding: utf-8 -*
+
+import cgi
+import http.client
+import sys
+
+from socket import gethostbyname, gaierror
+
+form = cgi.FieldStorage()
+print("Content-type: text/html; charset=utf-8\n")
+
+
+name = "Website"
+urls = ["neodarz.ovh","plex.neodarz.ovh","git.neodarz.ovh"]
+
+for url in urls:
+ try:
+ c = http.client.HTTPConnection(url)
+ c.request("HEAD", '')
+ status = str(c.getresponse().status)
+ except gaierror:
+ status = "Name or service unknow !"
+
+
+
+ html = """<!DOCTYPE html>
+ <head>
+ <title>Mon programme</title>
+ </head>
+ <body>
+ <p><a href='""" + url + """'> """ + url + """</a> ->""" + status + """</p>
+ </body>
+ </html>"""
+
+ print(html)