Soup.ContentSniffer¶
- Subclasses:
 None
Methods¶
- Inherited:
 - Structs:
 
class  | 
  | 
  | 
Virtual Methods¶
- Inherited:
 
  | 
Properties¶
None
Signals¶
- Inherited:
 
Fields¶
- Inherited:
 
Name  | 
Type  | 
Access  | 
Description  | 
|---|---|---|---|
parent  | 
r  | 
Class Details¶
- class Soup.ContentSniffer(**kwargs)¶
 - Bases:
 - Abstract:
 No
- Structure:
 
- classmethod new()¶
 - Returns:
 a new
Soup.ContentSniffer- Return type:
 
Creates a new
Soup.ContentSniffer.New in version 2.28.
- get_buffer_size()¶
 - Returns:
 the number of bytes to sniff
- Return type:
 
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 sniffbuffer (
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:
 
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:
 
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 sniffbuffer (
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:
 
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.