Skip to content

Commit 7c8f05a

Browse files
Python 2/3 compatibility, naming consistency
1 parent a7d2faf commit 7c8f05a

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

sendgrid/helpers/inbound/parse.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
import base64
33
import email
44
import mimetypes
5+
from six import iteritems
56
from werkzeug.utils import secure_filename
67

78

@@ -47,7 +48,7 @@ def attachments(self):
4748

4849
def _get_attachments(self, request):
4950
attachments = []
50-
for _, filestorage in request.files.iteritems():
51+
for _, filestorage in iteritems(request.files):
5152
attachment = {}
5253
if filestorage.filename not in (None, 'fdopen', '<fdopen>'):
5354
filename = secure_filename(filestorage.filename)
@@ -72,7 +73,7 @@ def _get_attachments_raw(self, raw_email):
7273
filename = 'part-%03d%s' % (counter, ext)
7374
counter += 1
7475
attachment['type'] = part.get_content_type()
75-
attachment['filename'] = filename
76+
attachment['file_name'] = filename
7677
attachment['contents'] = part.get_payload(decode=False)
7778
attachments.append(attachment)
7879
return attachments

0 commit comments

Comments
 (0)