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

Fix sendgrid attachment sending error #119

Merged
merged 1 commit into from Jan 3, 2019

Conversation

Projects
None yet
1 participant
@c-w
Copy link
Member

commented Jan 3, 2019

Stacktrace:

  File "/app/opwen_email_server/actions.py", line 32, in __call__
    return self._action(*args, **kwargs)
  File "/app/opwen_email_server/actions.py", line 59, in _action
    success = self._send_email(email)
  File "/app/opwen_email_server/services/sendgrid.py", line 43, in __call__
    return self._send_email(email, email_id)
  File "/app/opwen_email_server/services/sendgrid.py", line 49, in _send_email
    status = self._client(request)
  File "/app/opwen_email_server/services/sendgrid.py", line 35, in send_email
    response = client.client.mail.send.post(request_body=email)
  File "/venv/lib/python3.6/site-packages/python_http_client/client.py", line 236, in http_request
    kwargs['request_body']).encode('utf-8')
  File "/usr/local/lib/python3.6/json/__init__.py", line 231, in dumps
    return _default_encoder.encode(obj)
  File "/usr/local/lib/python3.6/json/encoder.py", line 199, in encode
    chunks = self.iterencode(o, _one_shot=True)
  File "/usr/local/lib/python3.6/json/encoder.py", line 257, in iterencode
    return _iterencode(o, 0)
  File "/usr/local/lib/python3.6/json/encoder.py", line 180, in default
    o.__class__.__name__)
TypeError: Object of type 'bytes' is not JSON serializable
Fix sendgrid attachment sending error
Stacktrace:

```
  File "/app/opwen_email_server/actions.py", line 32, in __call__
    return self._action(*args, **kwargs)
  File "/app/opwen_email_server/actions.py", line 59, in _action
    success = self._send_email(email)
  File "/app/opwen_email_server/services/sendgrid.py", line 43, in __call__
    return self._send_email(email, email_id)
  File "/app/opwen_email_server/services/sendgrid.py", line 49, in _send_email
    status = self._client(request)
  File "/app/opwen_email_server/services/sendgrid.py", line 35, in send_email
    response = client.client.mail.send.post(request_body=email)
  File "/venv/lib/python3.6/site-packages/python_http_client/client.py", line 236, in http_request
    kwargs['request_body']).encode('utf-8')
  File "/usr/local/lib/python3.6/json/__init__.py", line 231, in dumps
    return _default_encoder.encode(obj)
  File "/usr/local/lib/python3.6/json/encoder.py", line 199, in encode
    chunks = self.iterencode(o, _one_shot=True)
  File "/usr/local/lib/python3.6/json/encoder.py", line 257, in iterencode
    return _iterencode(o, 0)
  File "/usr/local/lib/python3.6/json/encoder.py", line 180, in default
    o.__class__.__name__)
TypeError: Object of type 'bytes' is not JSON serializable
```

@c-w c-w merged commit d1d201b into master Jan 3, 2019

2 of 3 checks passed

continuous-integration/travis-ci/pr The Travis CI build is in progress
Details
continuous-integration/travis-ci/push The Travis CI build passed
Details
pyup.io/safety-ci No dependencies with known security vulnerabilities.
Details

@c-w c-w deleted the fix-sendgrid branch Jan 3, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.