Skip to main content

No project description provided

Project description

Fast MIME

Support Rails/Marcel style MIME for Python.

It uses Apache Tike's rule.

It's customizable.

Install

pip install fast-mime

Usage

Detect MIME

from fast_mime import MIME
with open("a.pdf") as fi:
    mime = MIME(file=fi, name="a.pdf", declared_type="application/pdf", extension=".pdf")
    # all parameters are optional

Customize MIME rules

from fast_mime import Mime

# define your own mime rule
MIME = Mime.from_xmls(your_rule_file_name)

Patch MIME

class MyMime(Mime):
    def _patch(self):
        super()._patch()
        ...

Project details


Download files

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

Source Distribution

fast_mime-0.1.3.tar.gz (48.7 kB view hashes)

Uploaded Source

Built Distribution

fast_mime-0.1.3-py3-none-any.whl (50.8 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page