aboutsummaryrefslogtreecommitdiff
path: root/index.py
blob: 4982c16fbc4cd360c24f878eda1d04b54bffb526 (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='http://""" + url + """'> """ + url + """</a> ->""" + status + """</p>
    </body>
    </html>"""

    print(html)