Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

b'...' is not JSON serializable #1

Closed
nathan-osman opened this issue Jun 14, 2016 · 0 comments
Closed

b'...' is not JSON serializable #1

nathan-osman opened this issue Jun 14, 2016 · 0 comments
Labels

Comments

@nathan-osman
Copy link
Member

When passing a dict as an attachment to Connection.send(), there is no check whether the content value is a unicode or binary value. If a binary value is passed, the following exception is raised:

File "connection.py", line 80, in send
    'attachments': list(self._process_attachments(attachments)),
...
File "/usr/lib/python3.5/json/encoder.py", line 180, in default
    raise TypeError(repr(o) + " is not JSON serializable")
TypeError: b'...' is not JSON serializable

The correct behavior would be for Connection._process_attachments() to detect this, encode the value with base64, and set encoded to True in the JSON payload to Hectane.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant