# python-libmagic

# Usage
```python
import magic
import magic.flags
magic = magic.Magic(mimetype=True)
mimetype = magic.from_buffer("\x89\x50\x4E\x47\x0D\x0A\x1A\x0A")
print mimetype # => "image/png"
mimetype = magic.from_filepath("/etc/passwd")
print mimetype # => "text/plain"
updated = magic.set_flags(magic.flags.MAGIC_NONE)
print updated # => True
mimetype = magic.from_filepath("demo.docx")
print mimetype # => "Microsoft Word 2007+"
```
# Installation
```bash
$ apt-get install libmagic-dev
$ pip install python-libmagic
```
# License
Licensed under MIT license.

# Usage
```python
import magic
import magic.flags
magic = magic.Magic(mimetype=True)
mimetype = magic.from_buffer("\x89\x50\x4E\x47\x0D\x0A\x1A\x0A")
print mimetype # => "image/png"
mimetype = magic.from_filepath("/etc/passwd")
print mimetype # => "text/plain"
updated = magic.set_flags(magic.flags.MAGIC_NONE)
print updated # => True
mimetype = magic.from_filepath("demo.docx")
print mimetype # => "Microsoft Word 2007+"
```
# Installation
```bash
$ apt-get install libmagic-dev
$ pip install python-libmagic
```
# License
Licensed under MIT license.
Metadata
Release files for python-libmagic 0.3.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 | |
|---|---|---|---|
| python-libmagic-0.3.0.tar.gz | 3.2 kB | Details |
Release files / python-libmagic-0.3.0.tar.gz
| Download URL | python-libmagic-0.3.0.tar.gz |
|---|---|
| Size | 3.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
905343923b4febfa1ca239f4613eb50a86901b3a473ae3ce7982165274145177
|
|
BLAKE2b-256 checksum How to use checksums |
48ed7dc6c90e7ea0cbeb44ce9ef7e069368e56ac2c478ddb3a265b5e4ccc750b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |