# easyweb **Repository Path**: hujunfeng123456/easyweb ## Basic Information - **Project Name**: easyweb - **Description**: 用Python语言开发的HTTP协议的WEB框架。 特点是使用简单。 - **Primary Language**: Python - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2026-03-23 - **Last Updated**: 2026-03-23 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # easyweb #### 介绍 用Python语言开发的HTTP协议的WEB框架。 特点是使用简单。 #### 安装教程 1. 把代码拷贝到项目。 2. 使用http.py和websocket.py两个文件。 #### 使用说明 1. 创建下列的python源文件 ```python # 引入库文件http.py import http # 处理函数 # 参数req是请求对象,resp是响应对象 def test_01(req, resp): print("单参数:", req.param) print("多参数:", req.params) # 设置响应头Content-Type resp.setheader("Content-Type", "text/html;charset=UTF-8") data = "

Hello World

".encode("UTF-8") resp.setheader("Content-Length", str(len(data))) # 输出响应头部 resp.out_header() # 输出响应体的字节数据 resp.out_data(data) if __name__ == '__main__': port = 8888 # 创建程序,监听端口是8888 app = http.App(port=port) print(f"端口:{port}") # 添加处理器,监听"/test"路径,方法是GET,处理器函数是test_01() app.add_handler("/test", "GET", test_01) # 启动服务 app.run() ``` 2. 执行源程序 > python 源程序路径 3. 浏览器访问下列路径,查看响应的结果 http://localhost:8888/test 说明:可以添加参数,查看结果,例如http://localhost:8888/test?name=Peter&age=30