我正在尝试将脚本page从python v2转换为v3。我尝试使用2to3.py对其进行转换,但是当我按如下方式运行转换后的版本时,仍然收到错误消息:
ERROR:root:到远程服务器的连接['smtp.office365.com',587] 失败的回溯(最近一次呼叫最近):文件“ C:/ptunnel.py”,行 131,手柄中 self.connect_remote_via_proxy()在connect_remote_via_proxy中的文件“ C:/ptunnel.py”,第113行 sock.sendall(Tunnel.CONNECT%tuple(self.server.tunnel [1:]))TypeError:需要一个类似字节的对象,而不是'str'
我搜索了此错误,但仍然不知道如何解决。
调整该脚本的命令如下:
ptunnel.py -d -p <Proxy_ip>:<proxy_port> 5587:smtp.office365.com:587
5587 is the local port that will receive requests.
该代码允许使用CONNECT方法通过HTTP代理隧道smtp.office365.com
。
感谢您的帮助。