From 7702b33ac20349f5a57f086e41118ac35eefd696 Mon Sep 17 00:00:00 2001 From: "kuldeep.k@cisinlabs.com" Date: Fri, 27 Aug 2021 21:47:24 +0530 Subject: [PATCH] Updated code quality replaced unicode by decode function in api.py --- src/api.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/api.py b/src/api.py index c3b3919e..0ce12bb3 100644 --- a/src/api.py +++ b/src/api.py @@ -642,7 +642,7 @@ class BMRPCDispatcher(object): % type(eighteenByteRipe)) label = self._decode(label, "base64") try: - unicode(label, 'utf-8') + label.decode('utf-8') except UnicodeDecodeError: raise APIError(17, 'Label is not valid UTF-8 data.') queues.apiAddressGeneratorReturnQueue.queue.clear() @@ -773,7 +773,7 @@ class BMRPCDispatcher(object): # It would be nice to make the label the passphrase but it is # possible that the passphrase contains non-utf-8 characters. try: - unicode(passphrase, 'utf-8') + passphrase.decode('utf-8') label = str_chan + ' ' + passphrase except UnicodeDecodeError: label = str_chan + ' ' + repr(passphrase) @@ -805,7 +805,7 @@ class BMRPCDispatcher(object): # It would be nice to make the label the passphrase but it is # possible that the passphrase contains non-utf-8 characters. try: - unicode(passphrase, 'utf-8') + passphrase.decode('utf-8') label = str_chan + ' ' + passphrase except UnicodeDecodeError: label = str_chan + ' ' + repr(passphrase) @@ -1192,7 +1192,7 @@ class BMRPCDispatcher(object): if label: label = self._decode(label, "base64") try: - unicode(label, 'utf-8') + label.decode('utf-8') except UnicodeDecodeError: raise APIError(17, 'Label is not valid UTF-8 data.') self._verifyAddress(address)