修改Twisted中简单代理的html

2024-04-20 06:56:54 发布

您现在位置:Python中文网/ 问答频道 /正文

我用Twisted编写了一个简单的代理脚本,它运行得很好:

from twisted.internet import reactor
from twisted.web import proxy, server
site = server.Site(proxy.ReverseProxyResource('example.com', 80, ''.encode("utf-8")))
reactor.listenTCP(80, site)
reactor.run()

唯一的问题是,我想修改我的脚本从第三方站点获取的html,然后在服务器上呈现资源。我不确定在twisted/web/proxy.py中的何处插入/修改代码。在


Tags: fromimport脚本web代理serverexampletwisted