aboutsummaryrefslogtreecommitdiff
path: root/index.py
blob: cf8dd159a0af015bca9a487753413bb3a099fa8f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
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)