Skip to content

Mail.add_header doesn't accept a dict #997

Open
@tzachyrm

Description

@tzachyrm

Issue Summary

The docs mentions that the Mail.add_header should accept a dict of key-value pairs. However, when passing a dict, the function fails.

Steps to Reproduce

  1. Initialize a new Mail object
  2. Call add_header with a dict. According to the docs this should work.

Code Snippet

from sendgrid .helpers.mail import Mail
Mail().add_header({"X": "y"})

Exception/Log

Traceback (most recent call last):
  File "/env/lib/python3.8/site-packages/sendgrid/helpers/mail/mail.py", line 466, in add_header
    if header.personalization is not None:
AttributeError: 'dict' object has no attribute 'personalization'

Technical details:

  • sendgrid-python version: 6.7.1
  • python version: 3.8

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions