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.1.tar.gz
(48.6 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
fast_mime-0.1.1-py3-none-any.whl
(50.7 kB
view details)
File details
Details for the file fast_mime-0.1.1.tar.gz.
File metadata
- Download URL: fast_mime-0.1.1.tar.gz
- Upload date:
- Size: 48.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via:
poetry/1.8.2 CPython/3.12.2 Darwin/23.5.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
250306041127a86c5fce172e9aa3ca382c33af366efbfebe1abe48d88d1fb616
|
|
| MD5 |
e26d14ac92b9defe4d7856dca3211b32
|
|
| BLAKE2b-256 |
5bb6492ca07898de01f72067dcbb59ac10bfe7f89feb30fd822ce1382449c1cc
|
File details
Details for the file fast_mime-0.1.1-py3-none-any.whl.
File metadata
- Download URL: fast_mime-0.1.1-py3-none-any.whl
- Upload date:
- Size: 50.7 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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
22c08ed14b3e0a0f1ee5eb6308097fd7972dafb4e31329b94e12ce8b2c712c4a
|
|
| MD5 |
c89c7d946a87c86212f5cc645c5428e8
|
|
| BLAKE2b-256 |
88986b4378f2c7b312300bb3f8df90db556f477ec7790eaa514f1b1d4f27e4b6
|