Cleanup
This commit is contained in:
parent
7b29a32e8d
commit
23ab71a992
|
@ -38,7 +38,6 @@ class TorError(Exception):
|
||||||
|
|
||||||
|
|
||||||
def send_tor_signal(signal: Signal, confloc='./misc/tor/control.conf') -> bool:
|
def send_tor_signal(signal: Signal, confloc='./misc/tor/control.conf') -> bool:
|
||||||
|
|
||||||
try:
|
try:
|
||||||
# Try to authenticate with password.
|
# Try to authenticate with password.
|
||||||
with open(confloc, "r") as conf:
|
with open(confloc, "r") as conf:
|
||||||
|
@ -47,9 +46,9 @@ def send_tor_signal(signal: Signal, confloc='./misc/tor/control.conf') -> bool:
|
||||||
secret = line
|
secret = line
|
||||||
conf.close()
|
conf.close()
|
||||||
with Controller.from_port(port=9051) as c:
|
with Controller.from_port(port=9051) as c:
|
||||||
authenticate_password(c, password=secret)
|
authenticate_password(c, password=secret)
|
||||||
c.signal(signal)
|
c.signal(signal)
|
||||||
os.environ['TOR_AVAILABLE'] = '1'
|
os.environ['TOR_AVAILABLE'] = '1'
|
||||||
return True
|
return True
|
||||||
except (
|
except (
|
||||||
SocketError,
|
SocketError,
|
||||||
|
|
Loading…
Reference in New Issue
Block a user