Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/tombulled/mediatype
Media Type (aka MIME Type) parsing and creation
https://github.com/tombulled/mediatype
mime python
Last synced: 23 days ago
JSON representation
Media Type (aka MIME Type) parsing and creation
- Host: GitHub
- URL: https://github.com/tombulled/mediatype
- Owner: tombulled
- License: mit
- Created: 2021-04-06T08:38:45.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2024-08-14T22:49:48.000Z (4 months ago)
- Last Synced: 2024-11-12T23:43:06.183Z (about 1 month ago)
- Topics: mime, python
- Language: Python
- Homepage: https://pypi.org/project/mediatype/
- Size: 118 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# mediatype
Media Type (aka MIME Type) parsing and creation## Installation
```console
pip install mediatype
```## Usage
```python
>>> import mediatype
```### Parsing
```python
>>> media_type = mediatype.parse('application/manifest+json')
>>>
>>> media_type
MediaType(
type='application',
subtype='manifest',
suffix='json',
parameters=None
)
>>>
>>> str(media_type)
'application/manifest+json'
```### Creation
```python
>>> media_type = mediatype.MediaType(
type='application',
subtype='manifest',
suffix='json',
parameters=None
)
>>>
>>> str(media_type)
'application/manifest+json'
```## References
* [IANA - Media Types](https://www.iana.org/assignments/media-types/media-types.xhtml)
* [RFC-6838 - Media Type Specifications and Registration Procedures](https://www.rfc-editor.org/rfc/rfc6838.html)
* [Mozilla - MIME types (IANA media types)](https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types)
* [Wikipedia - Media type](https://en.wikipedia.org/wiki/Media_type)