base64 fixes

This commit is contained in:
Peter Šurda 2020-05-21 11:39:43 +08:00
parent d6e3721404
commit 33c5d5fc91
Signed by untrusted user: PeterSurda
GPG Key ID: 0C5F50C0B5F37D87

View File

@ -31,16 +31,16 @@ class BitmessageAutoresponder(): # pylint: disable=too-many-locals
def init_address(self): def init_address(self):
"""generate random address if there isn't one""" """generate random address if there isn't one"""
try: try:
addresses = json.loads(self.api.listAddresses2())['addresses'] addresses = json.loads(self.api.listAddresses())['addresses']
if addresses: if addresses:
return return
except KeyError: except KeyError:
pass pass
self.api.createRandomAddress(base64.b64encode(self.label)) self.api.createRandomAddress(base64.b64encode(self.label.encode()))
def loop(self): def loop(self):
"""Main loop""" """Main loop"""
for i in json.loads(self.api.listAddresses2())['addresses']: for i in json.loads(self.api.listAddresses())['addresses']:
self.addresses[i['address']] = True self.addresses[i['address']] = True
while True: while True: