Skip to main content

Stream IO for multipart MIME content

Project description

MIME content stream reader for Python.

mime-streamer is licensed under the MIT License (MIT).

Basic Usage

from StringIO import StringIO
from pkg_resources import resource_string
from mime_streamer import MIMEStreamer

raw = resource_string('tests', 'data/multipart_related_basic')

streamer = MIMEStreamer(StringIO(raw))

with streamer.get_next_part() as part:
    headers = part.headers
    assert 'Multipart/Related' in headers['content-type']
    assert 'start="<950120.aaCC@XIson.com>"' in headers['content-type']
    assert part.content.read() == ''

with streamer.get_next_part() as part:
    assert part.headers['content-id'] == '<950120.aaCC@XIson.com>'
    assert '10\r\n34\r\n10' in part.content.read()

with streamer.get_next_part() as part:
    assert part.headers['content-id'] == '<950120.aaCB@XIson.com>'
    assert 'gZHVja3MKRSBJIEUgSSB' in part.content.read()

Installation

pip install mime-streamer

Note

The library currently is missing the following features:

  • Nested multipart messages
  • Python 3.x

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for mime-streamer, version 0.1.0
Filename, size File type Python version Upload date Hashes
Filename, size mime-streamer-0.1.0.tar.gz (6.4 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page