
# Usage
```python
import magic
with magic.Magic() as m:
print m.from_buffer("hello") # => "text/plain"
```
```python
import magic
import magic.flags
magic = magic.Magic()
mimetype = magic.from_buffer("\x89\x50\x4E\x47\x0D\x0A\x1A\x0A")
print mimetype # => "image/png"
mimetype = magic.from_file("/etc/passwd")
print mimetype # => "text/plain"
updated = magic.set_flags(magic.flags.MAGIC_NONE)
print updated # => True
mimetype = magic.from_file("demo.docx")
print mimetype # => "Microsoft Word 2007+"
magic.close() # don't forget about this
```
# Installation
`python-libmagic` works on CPython 2.7/3.3+ and PyPy.
```bash
$ apt-get install libmagic-dev
$ pip install python-libmagic
```
# License
Licensed under MIT license.
Metadata
Release files for python-libmagic 0.4.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| python-libmagic-0.4.0.tar.gz | 3.6 kB | Without provenance | Details for python-libmagic-0.4.0.tar.gz |
Release files / python-libmagic-0.4.0.tar.gz
| Download URL | python-libmagic-0.4.0.tar.gz |
|---|---|
| Size | 3.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
fd42e14fca5f346e36b6a8e984f0798f02f38e5eb1b4868424b1480293baacb1
|
|
BLAKE2b-256 checksum How to use checksums |
43793bf793efcf94e730bf324b726b3ae551f9438869bb8995600784bdb17693
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for python-libmagic 0.4.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.