Soup.ContentSniffer

g GObject.GInterface GObject.GInterface Soup.SessionFeature Soup.SessionFeature GObject.GInterface->Soup.SessionFeature GObject.Object GObject.Object Soup.ContentSniffer Soup.ContentSniffer GObject.Object->Soup.ContentSniffer Soup.SessionFeature->Soup.ContentSniffer

Subclasses:

None

Methods

Inherited:

GObject.Object (37), Soup.SessionFeature (5)

Structs:

GObject.ObjectClass (5)

class

new ()

get_buffer_size ()

sniff (msg, buffer)

Virtual Methods

Inherited:

GObject.Object (7), Soup.SessionFeature (8)

do_get_buffer_size ()

do_sniff (msg, buffer)

Properties

None

Signals

Inherited:

GObject.Object (1)

Fields

Inherited:

GObject.Object (1)

Name

Type

Access

Description

parent

GObject.Object

r

Class Details

class Soup.ContentSniffer(**kwargs)
Bases:

GObject.Object, Soup.SessionFeature

Abstract:

No

Structure:

Soup.ContentSnifferClass

classmethod new()
Returns:

a new Soup.ContentSniffer

Return type:

Soup.ContentSniffer

Creates a new Soup.ContentSniffer.

New in version 2.28.

get_buffer_size()
Returns:

the number of bytes to sniff

Return type:

int

Gets the number of bytes self needs in order to properly sniff a buffer.

New in version 2.28.

sniff(msg, buffer)
Parameters:
  • msg (Soup.Message) – the message to sniff

  • buffer (Soup.Buffer) – a buffer containing the start of msg's response body

Returns:

the sniffed Content-Type of buffer; this will never be None, but may be “application/octet-stream”.

params:

return location for Content-Type parameters (eg, “charset”), or None

Return type:

(str, params: {str: str})

Sniffs buffer to determine its Content-Type. The result may also be influenced by the Content-Type declared in msg's response headers.

New in version 2.28.

do_get_buffer_size() virtual
Returns:

the number of bytes to sniff

Return type:

int

Gets the number of bytes sniffer needs in order to properly sniff a buffer.

New in version 2.28.

do_sniff(msg, buffer) virtual
Parameters:
  • msg (Soup.Message) – the message to sniff

  • buffer (Soup.Buffer) – a buffer containing the start of msg's response body

Returns:

the sniffed Content-Type of buffer; this will never be None, but may be “application/octet-stream”.

params:

return location for Content-Type parameters (eg, “charset”), or None

Return type:

(str, params: {str: str})

Sniffs buffer to determine its Content-Type. The result may also be influenced by the Content-Type declared in msg's response headers.

New in version 2.28.