Enums

Details

class Soup.CacheType(value)

Bases: GObject.GEnum

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

SINGLE_USER = 0

a single-user cache

SHARED = 1

a shared cache

class Soup.CookieJarAcceptPolicy(value)

Bases: GObject.GEnum

The policy for accepting or rejecting cookies returned in responses.

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 [method`Message`.set_first_party] on each outgoing [class`Message`], setting the [struct`GLib`.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.

GRANDFATHERED_THIRD_PARTY = 3

accept all cookies set by the main document loaded in the application using libsoup, and from domains that have previously set at least one cookie when loaded as the main document. 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 unless it already has a cookie in the cookie jar. For libsoup to be able to tell apart first party cookies from the rest, the application must call [method`Message`.set_first_party] on each outgoing Soup.Message, setting the [struct`GLib`.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 [func`date_time_to_string`] can use.

Soup.DateFormat.HTTP and Soup.DateFormat.COOKIE always coerce the time to UTC.

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”.

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)

HTTP_2_0 = 2

HTTP 2.0 (RFC 7540)

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

The lifetime of the memory being passed.

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 and libsoup will assume ownership of it and free it with [func`GLib`.free].

COPY = 2

The passed-in data belongs to the caller and libsoup will copy it into new memory leaving the caller free to reuse the original memory.

class Soup.MessageHeadersType(value)

Bases: GObject.GEnum

Value passed to [ctor`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 [class`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.SameSitePolicy(value)

Bases: GObject.GEnum

Represents the same-site policies of a cookie.

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.SessionError(value)

Bases: GObject.GEnum

A Soup.Session error.

classmethod quark()
Returns:

Error quark for Soup.Session.

Return type:

int

Registers error quark for Soup.Session if needed.

PARSING = 0

the server’s response could not be parsed

ENCODING = 1

the server’s response was in an unsupported format

TOO_MANY_REDIRECTS = 2

the message has been redirected too many times

TOO_MANY_RESTARTS = 3

the message has been restarted too many times

REDIRECT_NO_LOCATION = 4

failed to redirect message because Location header was missing or empty in response

REDIRECT_BAD_URI = 5

failed to redirect message because Location header contains an invalid URI

MESSAGE_ALREADY_IN_QUEUE = 6

the message is already in the session queue. Messages can only be reused after unqueued.

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.

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.

*There is no reason for you to ever use this function.* If you wanted the textual description for the [property`Message`:py:data::status-code<Soup.Status.props.status_code>] of a given [class`Message`], you should just look at the message’s [property`Message`:py:data::reason-phrase<Soup.Status.props.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.

NONE = 0

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

CONTINUE = 100

100 Continue (HTTP)

SWITCHING_PROTOCOLS = 101

101 Switching Protocols (HTTP)

PROCESSING = 102

102 Processing (WebDAV)

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)

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)

PERMANENT_REDIRECT = 308

308 Permanent Redirect (HTTP)

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)

MISDIRECTED_REQUEST = 421

421 Misdirected Request

UNPROCESSABLE_ENTITY = 422

422 Unprocessable Entity (WebDAV)

LOCKED = 423

423 Locked (WebDAV)

FAILED_DEPENDENCY = 424

424 Failed Dependency (WebDAV)

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)

class Soup.TLDError(value)

Bases: GObject.GEnum

Error codes for %SOUP_TLD_ERROR.

classmethod quark()
Returns:

Error quark for Soup TLD functions.

Return type:

int

Registers error quark for Soup.tld_get_base_domain() if needed.

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 [func`tld_get_base_domain`] on "co.uk".

NO_BASE_DOMAIN = 3

The passed-in hostname has no recognized public suffix.

NO_PSL_DATA = 4

The Public Suffix List was not available.

class Soup.URIComponent(value)

Bases: GObject.GEnum

Enum values passed to [func`uri_copy`] to indicate the components of the URI that should be updated with the given values.

NONE = 0

no component

SCHEME = 1

the URI scheme component

USER = 2

the URI user component

PASSWORD = 3

the URI password component

AUTH_PARAMS = 4

the URI authentication parameters component

HOST = 5

the URI host component

PORT = 6

the URI port component

PATH = 7

the URI path component

QUERY = 8

the URI query component

FRAGMENT = 9

the URI fragment component

class Soup.WebsocketCloseCode(value)

Bases: GObject.GEnum

Pre-defined close codes that can be passed to [method`WebsocketConnection`.close] or received from [method`WebsocketConnection`.get_close_code].

However, other codes are also allowed.

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 [class`WebsocketConnection`].

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 [signal`WebsocketConnection`:py:func:::message<Soup.WebsocketDataType.signals.message>] signal.

TEXT = 1

UTF-8 text

BINARY = 2

binary data

class Soup.WebsocketError(value)

Bases: GObject.GEnum

WebSocket-related errors.

classmethod quark()
Returns:

Error quark for SoupWebsocket.

Return type:

int

Registers error quark for SoupWebsocket if needed.

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.

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