Enums

Details

class Soup.AddressFamily(value)

Bases: GObject.GEnum

The supported address families.

INVALID = -1

an invalid Soup.Address

IPV6 = 10

an IPv6 address

IPV4 = 2

an IPv4 address

class Soup.CacheResponse(value)

Bases: GObject.GEnum

FRESH = 0
NEEDS_VALIDATION = 1
STALE = 2
class Soup.CacheType(value)

Bases: GObject.GEnum

The type of cache; this affects what kinds of responses will be saved.

New in version 2.34.

SINGLE_USER = 0

a single-user cache

SHARED = 1

a shared cache

class Soup.ConnectionState(value)

Bases: GObject.GEnum

NEW = 0
CONNECTING = 1
IDLE = 2
IN_USE = 3
REMOTE_DISCONNECTED = 4
DISCONNECTED = 5
class Soup.CookieJarAcceptPolicy(value)

Bases: GObject.GEnum

The policy for accepting or rejecting cookies returned in responses.

New in version 2.30.

ALWAYS = 0

accept all cookies unconditionally.

NEVER = 1

reject all cookies unconditionally.

NO_THIRD_PARTY = 2

accept all cookies set by the main document loaded in the application using libsoup. An example of the most common case, web browsers, would be: If http://www.example.com is the page loaded, accept all cookies set by example.com, but if a resource from http://www.third-party.com is loaded from that page reject any cookie that it could try to set. For libsoup to be able to tell apart first party cookies from the rest, the application must call Soup.Message.set_first_party() on each outgoing Soup.Message, setting the Soup.URI of the main document. If no first party is set in a message when this policy is in effect, cookies will be assumed to be third party by default.

class Soup.DateFormat(value)

Bases: GObject.GEnum

Date formats that Soup.Date.to_string() can use.

Soup.DateFormat.HTTP and Soup.DateFormat.COOKIE always coerce the time to UTC. Soup.DateFormat.ISO8601_XMLRPC uses the time as given, ignoring the offset completely. Soup.DateFormat.RFC2822 and the other ISO 8601 variants use the local time, appending the offset information if available.

This enum may be extended with more values in future releases.

HTTP = 1

RFC 1123 format, used by the HTTP “Date” header. Eg “Sun, 06 Nov 1994 08:49:37 GMT”

COOKIE = 2

The format for the “Expires” timestamp in the Netscape cookie specification. Eg, “Sun, 06-Nov-1994 08:49:37 GMT”.

RFC2822 = 3

RFC 2822 format, eg “Sun, 6 Nov 1994 09:49:37 -0100”

ISO8601_COMPACT = 4

ISO 8601 date/time with no optional punctuation. Eg, “19941106T094937-0100”.

ISO8601 = 5

An alias for Soup.DateFormat.ISO8601_FULL.

ISO8601_FULL = 5

ISO 8601 date/time with all optional punctuation. Eg, “1994-11-06T09:49:37-01:00”.

ISO8601_XMLRPC = 6

ISO 8601 date/time as used by XML-RPC. Eg, “19941106T09:49:37”.

class Soup.Encoding(value)

Bases: GObject.GEnum

How a message body is encoded for transport

UNRECOGNIZED = 0

unknown / error

NONE = 1

no body is present (which is not the same as a 0-length body, and only occurs in certain places)

CONTENT_LENGTH = 2

Content-Length encoding

EOF = 3

Response body ends when the connection is closed

CHUNKED = 4

chunked encoding (currently only supported for response)

BYTERANGES = 5

multipart/byteranges (Reserved for future use: NOT CURRENTLY IMPLEMENTED)

class Soup.HTTPVersion(value)

Bases: GObject.GEnum

Indicates the HTTP protocol version being used.

HTTP_1_0 = 0

HTTP 1.0 (RFC 1945)

HTTP_1_1 = 1

HTTP 1.1 (RFC 2616)

class Soup.KnownStatusCode(value)

Bases: GObject.GEnum

NONE = 0
CANCELLED = 1
TOO_MANY_REDIRECTS = 10
CONTINUE = 100
SWITCHING_PROTOCOLS = 101
PROCESSING = 102
TLS_FAILED = 11
CANT_RESOLVE = 2
OK = 200
CREATED = 201
ACCEPTED = 202
NON_AUTHORITATIVE = 203
NO_CONTENT = 204
RESET_CONTENT = 205
PARTIAL_CONTENT = 206
MULTI_STATUS = 207
CANT_RESOLVE_PROXY = 3
MULTIPLE_CHOICES = 300
MOVED_PERMANENTLY = 301
FOUND = 302
MOVED_TEMPORARILY = 302
SEE_OTHER = 303
NOT_MODIFIED = 304
USE_PROXY = 305
NOT_APPEARING_IN_THIS_PROTOCOL = 306
TEMPORARY_REDIRECT = 307
CANT_CONNECT = 4
BAD_REQUEST = 400
UNAUTHORIZED = 401
PAYMENT_REQUIRED = 402
FORBIDDEN = 403
NOT_FOUND = 404
METHOD_NOT_ALLOWED = 405
NOT_ACCEPTABLE = 406
PROXY_AUTHENTICATION_REQUIRED = 407
PROXY_UNAUTHORIZED = 407
REQUEST_TIMEOUT = 408
CONFLICT = 409
GONE = 410
LENGTH_REQUIRED = 411
PRECONDITION_FAILED = 412
REQUEST_ENTITY_TOO_LARGE = 413
REQUEST_URI_TOO_LONG = 414
UNSUPPORTED_MEDIA_TYPE = 415
INVALID_RANGE = 416
REQUESTED_RANGE_NOT_SATISFIABLE = 416
EXPECTATION_FAILED = 417
UNPROCESSABLE_ENTITY = 422
LOCKED = 423
FAILED_DEPENDENCY = 424
CANT_CONNECT_PROXY = 5
INTERNAL_SERVER_ERROR = 500
NOT_IMPLEMENTED = 501
BAD_GATEWAY = 502
SERVICE_UNAVAILABLE = 503
GATEWAY_TIMEOUT = 504
HTTP_VERSION_NOT_SUPPORTED = 505
INSUFFICIENT_STORAGE = 507
NOT_EXTENDED = 510
SSL_FAILED = 6
IO_ERROR = 7
MALFORMED = 8
TRY_AGAIN = 9
class Soup.LoggerLogLevel(value)

Bases: GObject.GEnum

Describes the level of logging output to provide.

NONE = 0

No logging

MINIMAL = 1

Log the Request-Line or Status-Line and the Soup-Debug pseudo-headers

HEADERS = 2

Log the full request/response headers

BODY = 3

Log the full headers and request/response bodies.

class Soup.MemoryUse(value)

Bases: GObject.GEnum

Describes how Soup.Buffer should use the data passed in by the caller.

See also Soup.Buffer.new_with_owner(), which allows to you create a buffer containing data which is owned by another object.

STATIC = 0

The memory is statically allocated and constant; libsoup can use the passed-in buffer directly and not need to worry about it being modified or freed.

TAKE = 1

The caller has allocated the memory for the Soup.Buffer’s use; libsoup will assume ownership of it and free it (with GLib.free()) when it is done with it.

COPY = 2

The passed-in data belongs to the caller; the Soup.Buffer will copy it into new memory, leaving the caller free to reuse the original memory.

TEMPORARY = 3

The passed-in data belongs to the caller, but will remain valid for the lifetime of the Soup.Buffer. The difference between this and Soup.MemoryUse.STATIC is that if you copy a Soup.MemoryUse.TEMPORARY buffer, it will make a copy of the memory as well, rather than reusing the original memory.

class Soup.MessageHeadersType(value)

Bases: GObject.GEnum

Value passed to Soup.MessageHeaders.new() to set certain default behaviors.

REQUEST = 0

request headers

RESPONSE = 1

response headers

MULTIPART = 2

multipart body part headers

class Soup.MessagePriority(value)

Bases: GObject.GEnum

Priorities that can be set on a Soup.Message to instruct the message queue to process it before any other message with lower priority.

VERY_LOW = 0

The lowest priority, the messages with this priority will be the last ones to be attended.

LOW = 1

Use this for low priority messages, a Soup.Message with the default priority will be processed first.

NORMAL = 2

The default priotity, this is the priority assigned to the Soup.Message by default.

HIGH = 3

High priority, a Soup.Message with this priority will be processed before the ones with the default priority.

VERY_HIGH = 4

The highest priority, use this for very urgent Soup.Message as they will be the first ones to be attended.

class Soup.RequestError(value)

Bases: GObject.GEnum

A Soup.Request error.

New in version 2.42.

classmethod quark()
Return type:int
BAD_URI = 0

the URI could not be parsed

UNSUPPORTED_URI_SCHEME = 1

the URI scheme is not supported by this Soup.Session

PARSING = 2

the server’s response could not be parsed

ENCODING = 3

the server’s response was in an unsupported format

class Soup.RequesterError(value)

Bases: GObject.GEnum

classmethod quark()
Return type:int
BAD_URI = 0
UNSUPPORTED_URI_SCHEME = 1
class Soup.SameSitePolicy(value)

Bases: GObject.GEnum

New in version 2.70.

NONE = 0

The cookie is exposed with both cross-site and same-site requests

LAX = 1

The cookie is withheld on cross-site requests but exposed on cross-site navigations

STRICT = 2

The cookie is only exposed for same-site requests

class Soup.SocketIOStatus(value)

Bases: GObject.GEnum

Return value from the Soup.Socket IO methods.

OK = 0

Success

WOULD_BLOCK = 1

Cannot read/write any more at this time

EOF = 2

End of file

ERROR = 3

Other error

class Soup.Status(value)

Bases: GObject.GEnum

These represent the known HTTP status code values, plus various network and internal errors.

Note that no libsoup functions take or return this type directly; any function that works with status codes will accept unrecognized status codes as well.

Prior to 2.44 this type was called SoupKnownStatusCode, but the individual values have always had the names they have now.

classmethod get_phrase(status_code)
Parameters:status_code (int) – an HTTP status code
Returns:the (terse, English) description of status_code
Return type:str

Looks up the stock HTTP description of status_code. This is used by Soup.Message.set_status() to get the correct text to go with a given status code.

There is no reason for you to ever use this function. If you wanted the textual description for the #SoupMessage:status_code of a given Soup.Message, you should just look at the message’s #SoupMessage:reason_phrase. However, you should only do that for use in debugging messages; HTTP reason phrases are not localized, and are not generally very descriptive anyway, and so they should never be presented to the user directly. Instead, you should create you own error messages based on the status code, and on what you were trying to do.

classmethod proxify(status_code)
Parameters:status_code (int) – a status code
Returns:the “proxified” equivalent of status_code.
Return type:int

Turns Soup.Status.CANT_RESOLVE into Soup.Status.CANT_RESOLVE_PROXY and Soup.Status.CANT_CONNECT into Soup.Status.CANT_CONNECT_PROXY. Other status codes are passed through unchanged.

New in version 2.26.

NONE = 0

No status available. (Eg, the message has not been sent yet)

CANCELLED = 1

Message was cancelled locally

TOO_MANY_REDIRECTS = 10

There were too many redirections

CONTINUE = 100

100 Continue (HTTP)

SWITCHING_PROTOCOLS = 101

101 Switching Protocols (HTTP)

PROCESSING = 102

102 Processing (WebDAV)

TLS_FAILED = 11

Used internally

CANT_RESOLVE = 2

Unable to resolve destination host name

OK = 200

200 Success (HTTP). Also used by many lower-level soup routines to indicate success.

CREATED = 201

201 Created (HTTP)

ACCEPTED = 202

202 Accepted (HTTP)

NON_AUTHORITATIVE = 203

203 Non-Authoritative Information (HTTP)

NO_CONTENT = 204

204 No Content (HTTP)

RESET_CONTENT = 205

205 Reset Content (HTTP)

PARTIAL_CONTENT = 206

206 Partial Content (HTTP)

MULTI_STATUS = 207

207 Multi-Status (WebDAV)

CANT_RESOLVE_PROXY = 3

Unable to resolve proxy host name

MULTIPLE_CHOICES = 300

300 Multiple Choices (HTTP)

MOVED_PERMANENTLY = 301

301 Moved Permanently (HTTP)

FOUND = 302

302 Found (HTTP)

MOVED_TEMPORARILY = 302

302 Moved Temporarily (old name, RFC 2068)

SEE_OTHER = 303

303 See Other (HTTP)

NOT_MODIFIED = 304

304 Not Modified (HTTP)

USE_PROXY = 305

305 Use Proxy (HTTP)

NOT_APPEARING_IN_THIS_PROTOCOL = 306

306 [Unused] (HTTP)

TEMPORARY_REDIRECT = 307

307 Temporary Redirect (HTTP)

CANT_CONNECT = 4

Unable to connect to remote host

BAD_REQUEST = 400

400 Bad Request (HTTP)

UNAUTHORIZED = 401

401 Unauthorized (HTTP)

PAYMENT_REQUIRED = 402

402 Payment Required (HTTP)

FORBIDDEN = 403

403 Forbidden (HTTP)

NOT_FOUND = 404

404 Not Found (HTTP)

METHOD_NOT_ALLOWED = 405

405 Method Not Allowed (HTTP)

NOT_ACCEPTABLE = 406

406 Not Acceptable (HTTP)

PROXY_AUTHENTICATION_REQUIRED = 407

407 Proxy Authentication Required (HTTP)

PROXY_UNAUTHORIZED = 407

shorter alias for Soup.Status.PROXY_AUTHENTICATION_REQUIRED

REQUEST_TIMEOUT = 408

408 Request Timeout (HTTP)

CONFLICT = 409

409 Conflict (HTTP)

GONE = 410

410 Gone (HTTP)

LENGTH_REQUIRED = 411

411 Length Required (HTTP)

PRECONDITION_FAILED = 412

412 Precondition Failed (HTTP)

REQUEST_ENTITY_TOO_LARGE = 413

413 Request Entity Too Large (HTTP)

REQUEST_URI_TOO_LONG = 414

414 Request-URI Too Long (HTTP)

UNSUPPORTED_MEDIA_TYPE = 415

415 Unsupported Media Type (HTTP)

INVALID_RANGE = 416

shorter alias for Soup.Status.REQUESTED_RANGE_NOT_SATISFIABLE

REQUESTED_RANGE_NOT_SATISFIABLE = 416

416 Requested Range Not Satisfiable (HTTP)

EXPECTATION_FAILED = 417

417 Expectation Failed (HTTP)

UNPROCESSABLE_ENTITY = 422

422 Unprocessable Entity (WebDAV)

LOCKED = 423

423 Locked (WebDAV)

FAILED_DEPENDENCY = 424

424 Failed Dependency (WebDAV)

CANT_CONNECT_PROXY = 5

Unable to connect to proxy

INTERNAL_SERVER_ERROR = 500

500 Internal Server Error (HTTP)

NOT_IMPLEMENTED = 501

501 Not Implemented (HTTP)

BAD_GATEWAY = 502

502 Bad Gateway (HTTP)

SERVICE_UNAVAILABLE = 503

503 Service Unavailable (HTTP)

GATEWAY_TIMEOUT = 504

504 Gateway Timeout (HTTP)

HTTP_VERSION_NOT_SUPPORTED = 505

505 HTTP Version Not Supported (HTTP)

INSUFFICIENT_STORAGE = 507

507 Insufficient Storage (WebDAV)

NOT_EXTENDED = 510

510 Not Extended (RFC 2774)

SSL_FAILED = 6

SSL/TLS negotiation failed

IO_ERROR = 7

A network error occurred, or the other end closed the connection unexpectedly

MALFORMED = 8

Malformed data (usually a programmer error)

TRY_AGAIN = 9

Used internally

class Soup.TLDError(value)

Bases: GObject.GEnum

Error codes for %SOUP_TLD_ERROR.

New in version 2.40.

classmethod quark()
Return type:int
INVALID_HOSTNAME = 0

A hostname was syntactically invalid.

IS_IP_ADDRESS = 1

The passed-in “hostname” was actually an IP address (and thus has no base domain or public suffix).

NOT_ENOUGH_DOMAINS = 2

The passed-in hostname did not have enough components. Eg, calling Soup.tld_get_base_domain() on "co.uk".

NO_BASE_DOMAIN = 3

The passed-in hostname has no recognized public suffix.

NO_PSL_DATA = 4
class Soup.WebsocketCloseCode(value)

Bases: GObject.GEnum

Pre-defined close codes that can be passed to Soup.WebsocketConnection.close() or received from Soup.WebsocketConnection.get_close_code(). (However, other codes are also allowed.)

New in version 2.50.

NORMAL = 1000

a normal, non-error close

GOING_AWAY = 1001

the client/server is going away

PROTOCOL_ERROR = 1002

a protocol error occurred

UNSUPPORTED_DATA = 1003

the endpoint received data of a type that it does not support.

NO_STATUS = 1005

reserved value indicating that no close code was present; must not be sent.

ABNORMAL = 1006

reserved value indicating that the connection was closed abnormally; must not be sent.

BAD_DATA = 1007

the endpoint received data that was invalid (eg, non-UTF-8 data in a text message).

POLICY_VIOLATION = 1008

generic error code indicating some sort of policy violation.

TOO_BIG = 1009

the endpoint received a message that is too big to process.

NO_EXTENSION = 1010

the client is closing the connection because the server failed to negotiate a required extension.

SERVER_ERROR = 1011

the server is closing the connection because it was unable to fulfill the request.

TLS_HANDSHAKE = 1015

reserved value indicating that the TLS handshake failed; must not be sent.

class Soup.WebsocketConnectionType(value)

Bases: GObject.GEnum

The type of a Soup.WebsocketConnection.

New in version 2.50.

UNKNOWN = 0

unknown/invalid connection

CLIENT = 1

a client-side connection

SERVER = 2

a server-side connection

class Soup.WebsocketDataType(value)

Bases: GObject.GEnum

The type of data contained in a Soup.WebsocketConnection ::message signal.

New in version 2.50.

TEXT = 1

UTF-8 text

BINARY = 2

binary data

class Soup.WebsocketError(value)

Bases: GObject.GEnum

WebSocket-related errors.

New in version 2.50.

classmethod get_quark()
Return type:int
FAILED = 0

a generic error

NOT_WEBSOCKET = 1

attempted to handshake with a server that does not appear to understand WebSockets.

BAD_HANDSHAKE = 2

the WebSocket handshake failed because some detail was invalid (eg, incorrect accept key).

BAD_ORIGIN = 3

the WebSocket handshake failed because the “Origin” header was not an allowed value.

class Soup.WebsocketState(value)

Bases: GObject.GEnum

The state of the WebSocket connection.

New in version 2.50.

OPEN = 1

the connection is ready to send messages

CLOSING = 2

the connection is in the process of closing down; messages may be received, but not sent

CLOSED = 3

the connection is completely closed down

class Soup.XMLRPCError(value)

Bases: GObject.GEnum

classmethod quark()
Return type:int
ARGUMENTS = 0
RETVAL = 1
class Soup.XMLRPCFault(value)

Bases: GObject.GEnum

Pre-defined XML-RPC fault codes from http://xmlrpc-epi.sourceforge.net/specs/rfc.fault_codes.php. These are an extension, not part of the XML-RPC spec; you can’t assume servers will use them.

classmethod quark()
Return type:int
TRANSPORT_ERROR = -32300

start of reserved range for transport error codes

SYSTEM_ERROR = -32400

start of reserved range for system error codes

APPLICATION_ERROR = -32500

start of reserved range for application error codes

SERVER_ERROR_INVALID_XML_RPC = -32600

request was not valid XML-RPC

SERVER_ERROR_REQUESTED_METHOD_NOT_FOUND = -32601

method not found

SERVER_ERROR_INVALID_METHOD_PARAMETERS = -32602

invalid parameters

SERVER_ERROR_INTERNAL_XML_RPC_ERROR = -32603

internal error

PARSE_ERROR_NOT_WELL_FORMED = -32700

request was not well-formed

PARSE_ERROR_UNSUPPORTED_ENCODING = -32701

request was in an unsupported encoding

PARSE_ERROR_INVALID_CHARACTER_FOR_ENCODING = -32702

request contained an invalid character