GMime.ContentType

g GMime.ContentType GMime.ContentType GObject.Object GObject.Object GObject.Object->GMime.ContentType

Subclasses:

None

Methods

Inherited:

GObject.Object (37)

Structs:

GObject.ObjectClass (5)

class

new (type, subtype)

class

parse (options, str)

encode (options)

get_media_subtype ()

get_media_type ()

get_mime_type ()

get_parameter (name)

get_parameters ()

is_type (type, subtype)

set_media_subtype (subtype)

set_media_type (type)

set_parameter (name, value)

Virtual Methods

Inherited:

GObject.Object (7)

Properties

None

Signals

Inherited:

GObject.Object (1)

Fields

Inherited:

GObject.Object (1)

Name

Type

Access

Description

changed

object

r

params

GMime.ParamList

r

a GMime.Param list

parent_object

GObject.Object

r

parent GObject.Object

subtype

str

r

media subtype

type

str

r

media type

Class Details

class GMime.ContentType(**kwargs)
Bases:

GObject.Object

Abstract:

No

Structure:

GMime.ContentTypeClass

A data structure representing a Content-Type.

classmethod new(type, subtype)
Parameters:
  • type (str) – the MIME type or None for the default value

  • subtype (str) – the MIME subtype or None for the default value

Returns:

a new GMime.ContentType object.

Return type:

GMime.ContentType

Creates a Content-Type object with type type and subtype subtype.

classmethod parse(options, str)
Parameters:
Returns:

a new GMime.ContentType object.

Return type:

GMime.ContentType

Parses the input string into a GMime.ContentType object.

encode(options)
Parameters:

options (GMime.FormatOptions or None) – a GMime.FormatOptions or None

Returns:

a new string containing the encoded header value.

Return type:

str

Encodes the Content-Disposition header.

get_media_subtype()
Returns:

the Content-Type’s media sub-type.

Return type:

str

Gets the Content-Type’s media sub-type.

get_media_type()
Returns:

the Content-Type’s media type.

Return type:

str

Gets the Content-Type’s media type.

get_mime_type()
Returns:

an allocated string containing the type and subtype of the content-type in the format: type/subtype.

Return type:

str

Allocates a string buffer containing the type and subtype defined by the self.

get_parameter(name)
Parameters:

name (str) – parameter name (aka attribute)

Returns:

the value of the requested parameter or None if the parameter is not set. If the parameter is set, the returned string will be in UTF-8.

Return type:

str

Gets the parameter value specified by name if it’s available.

get_parameters()
Returns:

the Content-Type’s parameter list.

Return type:

GMime.ParamList

Gets the Content-Type’s parameter list.

is_type(type, subtype)
Parameters:
  • type (str) – MIME type to compare against

  • subtype (str) – MIME subtype to compare against

Returns:

True if the MIME types match or False otherwise. You may use “*” in place of type and/or subtype as a wilcard.

Return type:

bool

Compares the given type and subtype with that of the given mime type object.

set_media_subtype(subtype)
Parameters:

subtype (str) – media subtype

Sets the Content-Type’s media subtype.

set_media_type(type)
Parameters:

type (str) – media type

Sets the Content-Type’s media type.

set_parameter(name, value)
Parameters:
  • name (str) – parameter name (aka attribute)

  • value (str) – parameter value

Sets a parameter on the Content-Type.

Note: The name should be in US-ASCII while the value should be in UTF-8.