![](/img/trans.png)
[英]Tor IP Rotation in Python - stem.SocketError: [Errno 61] Connection refused
[英]stem.SocketError: [Errno 111] Connection refused
我正在尝试将 flask 应用程序部署为 a.onion 站点。 我正在使用茎。 我已经阅读了很多教程,但仍然出现了这个错误:
stem.SocketError: [Errno 111] 连接被拒绝
我已经配置了 torrc,并且我已经更改了 Tor 隐藏服务的密码。 我什至尝试调整代码顺序(无济于事。)。 有谁知道出了什么问题?
这是代码(这是教程的原件(我已经尝试过没有自己的东西。)):
from stem.control import Controller
from flask import Flask
if __name__ == "__main__":
app = Flask("example")
port = 5000
host = "127.0.0.1"
hidden_svc_dir = "c:/temp/"
@app.route('/')
def index():
return "<h1>Tor works!</h1>"
print (" * Getting controller")
controller = Controller.from_port(address="127.0.0.1", port=9151)
try:
controller.authenticate(password="my_password")
controller.set_options([
("HiddenServiceDir", hidden_svc_dir),
("HiddenServicePort", "80 %s:%s" % (host, str(port)))
])
svc_name = open(hidden_svc_dir + "/hostname", "r").read().strip()
print (" * Created host: %s" % svc_name)
except Exception as e:
print (e)
app.run()
您正在使用两个不同的端口。 从 9151 获取 controller,然后为 5000 设置选项。尝试在两个地方使用相同的端口。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.