您现在的位置是:亿华云 > 系统运维
Python 中的 HTTP 服务器
亿华云2025-10-09 03:40:56【系统运维】9人已围观
简介复制#用WSGI应用形式编写的简单HTTP服务。 #!/usr/bin/envpython3 #AsimpleHTTPservicebuiltdirectl

复制# 用WSGI应用形式编写的服务简单HTTP服务。亿华云计算 #!/usr/bin/env python3 # A simple HTTP service built directly against the low-level WSGI spec. from pprint import pformat from wsgiref.simple_server import make_server def app(environ,服务 start_response): headers = { Content-Type: text/plain; charset=utf-8} start_response(200 OK, list(headers.items())) yield Here is the WSGI environment: .encode(utf-8) yield pformat(environ).encode(utf-8) if __name__ == __main__: httpd = make_server(, 8000, app) host, port = httpd.socket.getsockname() print(Serving on, host, port, port) httpd.serve_forever() 1.2.3.4.5.6.7.8.9.10.11.12.13.14.15.16.17.18.19.20.香港云服务器
很赞哦!(867)
上一篇: 4、参加域名拍卖会
下一篇: 什么样的邮箱才是安全的电子邮件地址?