Skip to main content

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()
        ...

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 details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

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

Uploaded Python 3

File details

Details for the file fast_mime-0.1.3.tar.gz.

File metadata

  • Download URL: fast_mime-0.1.3.tar.gz
  • Upload date:
  • Size: 48.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.2 CPython/3.12.2 Darwin/23.5.0

File hashes

Hashes for fast_mime-0.1.3.tar.gz
Algorithm Hash digest
SHA256 1bd1c62ce9110cd246b9bb9ac82c5543d74d0d01460e5ddec2256aed2d00668b
MD5 6ae8e5d1b07427e0c9c1af2586a89c55
BLAKE2b-256 a99509e6af2490b2781baf9a8ab81d64cfab2442bb161424aed53227e77423ee

See more details on using hashes here.

File details

Details for the file fast_mime-0.1.3-py3-none-any.whl.

File metadata

  • Download URL: fast_mime-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 50.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.2 CPython/3.12.2 Darwin/23.5.0

File hashes

Hashes for fast_mime-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 67fc11e77dfba07a4c88520fdf0a529aafe2db81ae593462495eb0b726b38cf6
MD5 458edf91ddf8689e68b059936360ab97
BLAKE2b-256 10779050e403b587327fc5e1862f4c14976a6b3a51561f3262883c2d20f2d097

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.1.3 This release

2 files

0.1.2

2 files

0.1.1

2 files

0.1.0

2 files

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page