rbtools.api.utils¶
Utilities used by the API interfaces.
Functions
|
Parse a mime type into its component parts. |
|
Strip the subtype from a mimetype, leaving vendor specific information. |
Classes
A MIME type, parsed into its component parts. |
- class rbtools.api.utils.ParsedMIMEType[source]¶
Bases:
TypedDict
A MIME type, parsed into its component parts.
New in version 4.0.
- vendor: str¶
The vendor tag, if available.
For example, “vnd.reviewboard.org.test” in “application/vnd.reviewboard.org.test+json”.
- Type:
- format: str¶
The sub-type format, if available.
For example, “json” in “application/vnd.reviewboard.org.test+json”.
- Type:
- resource: str¶
The particular API resource name, if available.
For example, “test” in “application/vnd.reviewboard.org.test+json”.
- Type:
- __optional_keys__ = frozenset({})¶
- __orig_bases__ = (<function TypedDict>,)¶
- __required_keys__ = frozenset({'format', 'main_type', 'resource', 'sub_type', 'type', 'vendor'})¶
- __total__ = True¶
- rbtools.api.utils.parse_mimetype(mime_type: str) ParsedMIMEType [source]¶
Parse a mime type into its component parts.
- Parameters:
mime_type (
str
) – The MIME type to parse.- Returns:
The type, parsed into its component parts.
- Return type: