根据以下代码写一份报告from http.server import BaseHTTPRequestHandler, HTTPServer
from http.server import HTTPServer, SimpleHTTPRequestHandler
from urllib.parse import parse_qs
import re
class SimpleHTTPRequestHandler(BaseHTTPRequestHandler):
    def validate_id_number(id_num):
        if len(id_num) == 15:
            id_num = upgrade_id_number(id_num)
        if len(id_num) != 18:
            return "不合法"
        if not re.match(r'^\d{17}$', id_num[:17]):
            return "不合法"
        factors = [7, 9, 10, 5, 8, 4, 2, 1, 6, 3, 7, 9, 10, 5, 8, 4, 2]
        checksum = sum(int(n) * f for n, f in zip(id_num[:17], factors))
        check_digit = str((12 - (checksum % 11)) % 11)
        if check_digit == '10':
            check_digit = 'X'
        if check_digit != id_num[-1].upper():
            return "不合法"
        return "合法"

    def get_gender(id_num):
        gender_digit = int(id_num[-2])
        if gender_digit % 2 == 0:
            return "女"
        else:
            return "男"

    def get_birth_date(id_num):
        year = id_num[6:10]
        month = id_num[10:12]
        day = id_num[12:14]
        birth_date = "{}-{}-{}".format(year, month, day)
        return birth_date

    def get_birth_place(id_num):
        place_code = id_num[0:2]
        if place_code == '11':
            return "北京"
        elif place_code == '12':
            return "天津"
        elif place_code == '13':
            return "河北"
        elif place_code == '14':
            return "山西"
        elif place_code == '15':
            return "内蒙古"
        else:
            return "未知"
    def do_GET(self):
        if self.path == '/':
            self.send_response(200)
            self.send_header('Content-Type', 'text/html')
            self.end_headers()
            self.wfile.write('''
                    <!DOCTYPE html>
                    <html>
                        <head>
                            <meta charset="UTF-8">
                            <title>身份证号码校验系统</title>
                        </head>
                        <body>
                            <h1>身份证号码校验系统</h1>
                            <form method="POST" action="/check">
                                <label for="idcard">请输入身份证号码：</label>
                                <input type="text" id="idcard" name="idcard" required>
                                <input type="submit" value="校验">
                            </form>
                        </body>
                    </html>
                    '''.encode('utf-8'))  # 把字符串编码为字节串
                    
    def do_POST(self):
        if self.path == '/check':
        
            content_length = int(self.headers['Content-Length'])
            post_data = self.rfile.read(content_length).decode('utf-8')
            match = re.search(r'id=(\d+)', post_data)
            if match:
                id_num = match.group(1)
                validation_result = validate_id_number(id_num)
                gender = get_gender(id_num)
                birth_date = get_birth_date(id_num)
                birth_place = get_birth_place(id_num)


                self.send_response(200)
                self.send_header('Content-Type', 'text/html')
                self.end_headers()
                self.wfile.write('''
                        <!DOCTYPE html>
                        <html>
                            <head>
                                <title>校验结果</title>
                            </head>
                            <body>
                                <h1>校验结果</h1>
        
                                <p>校验结果：{}</p>
                                <p>性别：{}</p>
                                <p>出生日期：{}</p>
                                <p>出生地：{}</p>
                            </body>
                        </html>
                        '''.encode('utf-8'))  # 把字符串编码为字节串
            else:
                self.send_response(400)  # 请求参数错误
                self.end_headers()
        else:
            self.send_response(404)  # 页面不存在
            self.end_headers()



       

    
if __name__ == "__main__":
    server_address = ('127.0.0.1', 8000)
    httpd = HTTPServer(server_address, SimpleHTTPRequestHandler)
    print(f'运行在 http://{server_address[0]}:{server_address[1]}/')
    httpd.serve_forever()