Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(214)

Side by Side Diff: third_party/google-endpoints/future/backports/email/mime/application.py

Issue 2666783008: Add google-endpoints to third_party/. (Closed)
Patch Set: Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 # Copyright (C) 2001-2006 Python Software Foundation
2 # Author: Keith Dart
3 # Contact: email-sig@python.org
4
5 """Class representing application/* type MIME documents."""
6 from __future__ import unicode_literals
7 from __future__ import division
8 from __future__ import absolute_import
9
10 from future.backports.email import encoders
11 from future.backports.email.mime.nonmultipart import MIMENonMultipart
12
13 __all__ = ["MIMEApplication"]
14
15
16 class MIMEApplication(MIMENonMultipart):
17 """Class for generating application/* MIME documents."""
18
19 def __init__(self, _data, _subtype='octet-stream',
20 _encoder=encoders.encode_base64, **_params):
21 """Create an application/* type MIME document.
22
23 _data is a string containing the raw application data.
24
25 _subtype is the MIME content type subtype, defaulting to
26 'octet-stream'.
27
28 _encoder is a function which will perform the actual encoding for
29 transport of the application data, defaulting to base64 encoding.
30
31 Any additional keyword arguments are passed to the base class
32 constructor, which turns them into parameters on the Content-Type
33 header.
34 """
35 if _subtype is None:
36 raise TypeError('Invalid application MIME subtype')
37 MIMENonMultipart.__init__(self, 'application', _subtype, **_params)
38 self.set_payload(_data)
39 _encoder(self)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698