From a4ffa0b22a9577f2aaa8bb731af4671ad3dc6a3d Mon Sep 17 00:00:00 2001 From: SomberNight Date: Wed, 29 Aug 2018 18:59:47 +0200 Subject: [PATCH] interface: clean-up proxy username/pw handling --- electrum/interface.py | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/electrum/interface.py b/electrum/interface.py index b386f0f77..ad6ea7c1b 100644 --- a/electrum/interface.py +++ b/electrum/interface.py @@ -62,16 +62,11 @@ class Interface(PrintError): self.blockchain = None self.network = network if proxy: - proxy['user'] = proxy.get('user', '') - if proxy['user'] == '': - proxy['user'] = 'sampleuser' # aiorpcx doesn't allow empty user - proxy['password'] = proxy.get('password', '') - if proxy['password'] == '': - proxy['password'] = 'samplepassword' - try: - auth = aiorpcx.socks.SOCKSUserAuth(proxy['user'], proxy['password']) - except KeyError: + username, pw = proxy.get('user'), proxy.get('password') + if not username or not pw: auth = None + else: + auth = aiorpcx.socks.SOCKSUserAuth(username, pw) if proxy['mode'] == "socks4": self.proxy = aiorpcx.socks.SOCKSProxy((proxy['host'], int(proxy['port'])), aiorpcx.socks.SOCKS4a, auth) elif proxy['mode'] == "socks5":