Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions neon_mq_connector/utils/network_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,10 @@
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

import json
import base64
import socket

from pybase64 import b64encode, b64decode

"""
These utils are duplicated from neon_utils.socket_utils to avoid a circular
dependency.
Expand All @@ -44,7 +45,7 @@ def b64_to_dict(data: bytes, charset: str = "utf-8") -> dict:

@return decoded dictionary
"""
return eval(json.loads(base64.b64decode(data).decode(charset)))
return eval(json.loads(b64decode(data).decode(charset)))


def dict_to_b64(data: dict, charset: str = "utf-8") -> bytes:
Expand All @@ -55,7 +56,7 @@ def dict_to_b64(data: dict, charset: str = "utf-8") -> bytes:

@return base64 encoded string
"""
return base64.b64encode(json.dumps(str(data)).encode(charset))
return b64encode(json.dumps(str(data)).encode(charset))


def check_port_is_open(addr: str, port: int) -> bool:
Expand Down
1 change: 1 addition & 0 deletions requirements/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
pika==1.2.0
ovos-config~=0.0,>=0.0.8
ovos-utils~=0.0,>=0.0.32
pybase64~=1.4
Loading