From a2f4f4b3e07ca4f83d3db3c0d960890ba21fddca Mon Sep 17 00:00:00 2001 From: peter-tank <30540412+peter-tank@users.noreply.github.com> Date: Thu, 19 Jul 2018 01:45:26 +0800 Subject: [PATCH] * Fix fail on no password protected API daemon connection initial. Signed-off-by: peter-tank <30540412+peter-tank@users.noreply.github.com> --- src/bitmessagecli.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/bitmessagecli.py b/src/bitmessagecli.py index 16f86ce1..4be2898b 100644 --- a/src/bitmessagecli.py +++ b/src/bitmessagecli.py @@ -261,7 +261,7 @@ class Config(object): # action = self.subparsers.add_parser('api', help='Set API settings.') action.add_argument('--api_username', help='BMs API basic auth user name.', default=None, metavar='username') action.add_argument('--api_password', help='BMs API basic auth password.', default=None, metavar='password') - action.add_argument('--api_path', help='BMs API host address.', default=self.conn, metavar='ip:port') + action.add_argument('--api_path', help='BMs API host address.', default='127.0.0.1:8445', metavar='ip:port') action.add_argument('--api_type', help='BMs API hosts type.', default='HTTP', choices=["HTTP", "HTTPS"]) # proxy settings @@ -630,12 +630,12 @@ class Proxiedxmlrpclib(xmlrpclib.ServerProxy): allow_none=0, use_datetime=0, timeout=None, proxy=None): scheme, netloc, path, x, xx, xxx = urlparse(uri) - api_username = unquote(urlparse(uri).username) - api_password = unquote(urlparse(uri).password) + api_username = urlparse(uri).username + api_password = urlparse(uri).password api_cred = None self.uri = uri if api_username and api_password: - api_cred = base64.encodestring('%s:%s' % (api_username, api_password)).strip() + api_cred = base64.encodestring('%s:%s' % (unquote(api_username), unquote(api_password))).strip() netloc = netloc.split('@')[1] if transport is None and (timeout or proxy):