Coverage for /var/srv/projects/api.amasfac.comuna18.com/tmp/venv/lib/python3.9/site-packages/sendgrid/helpers/mail/header.py: 39%
34 statements
« prev ^ index » next coverage.py v6.4.4, created at 2023-07-17 14:22 -0600
« prev ^ index » next coverage.py v6.4.4, created at 2023-07-17 14:22 -0600
1class Header(object):
2 """A header to specify specific handling instructions for your email.
4 If the name or value contain Unicode characters, they must be properly
5 encoded. You may not overwrite the following reserved headers:
6 x-sg-id, x-sg-eid, received, dkim-signature, Content-Type,
7 Content-Transfer-Encoding, To, From, Subject, Reply-To, CC, BCC
8 """
10 def __init__(self, key=None, value=None, p=None):
11 """Create a Header.
13 :param key: The name of the header (e.g. "Date")
14 :type key: string, optional
15 :param value: The header's value (e.g. "2013-02-27 1:23:45 PM PDT")
16 :type value: string, optional
17 :param name: p is the Personalization object or Personalization object
18 index
19 :type name: Personalization, integer, optional
20 """
21 self._key = None
22 self._value = None
23 self._personalization = None
25 if key is not None:
26 self.key = key
27 if value is not None:
28 self.value = value
29 if p is not None:
30 self.personalization = p
32 @property
33 def key(self):
34 """The name of the header.
36 :rtype: string
37 """
38 return self._key
40 @key.setter
41 def key(self, value):
42 """The name of the header.
44 :param value: The name of the header.
45 :type value: string
46 """
47 self._key = value
49 @property
50 def value(self):
51 """The value of the header.
53 :rtype: string
54 """
55 return self._value
57 @value.setter
58 def value(self, value):
59 """The value of the header.
61 :param value: The value of the header.
62 :type value: string
63 """
64 self._value = value
66 @property
67 def personalization(self):
68 """The Personalization object or Personalization object index
70 :rtype: Personalization, integer
71 """
72 return self._personalization
74 @personalization.setter
75 def personalization(self, value):
76 """The Personalization object or Personalization object index
78 :param value: The Personalization object or Personalization object
79 index
80 :type value: Personalization, integer
81 """
82 self._personalization = value
84 def get(self):
85 """
86 Get a JSON-ready representation of this Header.
88 :returns: This Header, ready for use in a request body.
89 :rtype: dict
90 """
91 header = {}
92 if self.key is not None and self.value is not None:
93 header[self.key] = self.value
94 return header