Soup.CookieJarDB

g GObject.GInterface GObject.GInterface Gio.Initable Gio.Initable GObject.GInterface->Gio.Initable Soup.SessionFeature Soup.SessionFeature GObject.GInterface->Soup.SessionFeature GObject.Object GObject.Object Soup.CookieJar Soup.CookieJar GObject.Object->Soup.CookieJar Soup.CookieJarDB Soup.CookieJarDB Gio.Initable->Soup.CookieJarDB Soup.CookieJar->Soup.CookieJarDB Soup.SessionFeature->Soup.CookieJar

Subclasses:

None

Methods

Inherited:

Soup.CookieJar (14), GObject.Object (37), Gio.Initable (2)

Structs:

GObject.ObjectClass (5)

class

new (filename, read_only)

class

new_with_error (filename, read_only)

get_max_size ()

set_max_size (max_size)

Virtual Methods

Inherited:

Soup.CookieJar (3), GObject.Object (7), Gio.Initable (1)

Properties

Inherited:

Soup.CookieJar (2)

Name

Type

Flags

Short Description

filename

str

r/w/co

Cookie-storage filename

max-size

int

r/w/co/en

Signals

Inherited:

Soup.CookieJar (1), GObject.Object (1)

Fields

Inherited:

Soup.CookieJar (1), GObject.Object (1)

Class Details

class Soup.CookieJarDB(**kwargs)
Bases:

Soup.CookieJar, Gio.Initable

Abstract:

No

Structure:

Soup.CookieJarDBClass

Database-based Cookie Jar.

[class`CookieJarDB`] is a [class`CookieJar`] that reads cookies from and writes them to a sqlite database in the new Mozilla format.

(This is identical to SoupCookieJarSqlite in libsoup-gnome; it has just been moved into libsoup proper, and renamed to avoid conflicting.)

Since 3.8 this class implements [iface`Gio`.Initable] to track failures opening the database. See [ctor`SoupCookieJarDB`.new_with_error].

classmethod new(filename, read_only)
Parameters:
  • filename (str) – the filename to read to/write from, or None

  • read_only (bool) – True if filename is read-only

Returns:

the new Soup.CookieJar

Return type:

Soup.CookieJar

Creates a [class`CookieJarDB`].

filename will be read in at startup to create an initial set of cookies. If read_only is False, then the non-session cookies will be written to filename when the [signal`CookieJar`:py:func:::changed<Soup.CookieJarDB.signals.changed>] signal is emitted from the jar. (If read_only is True, then the cookie jar will only be used for this session, and changes made to it will be lost when the jar is destroyed.)

classmethod new_with_error(filename, read_only)
Parameters:
  • filename (str) – the filename to read to/write from

  • read_only (bool) – True if filename is read-only

Raises:

GLib.Error

Returns:

the new Soup.CookieJar, or None on error

Return type:

Soup.CookieJar

Creates a [class`CookieJarDB`], returning None and setting error if the database file cannot be opened.

Added in version 3.8.

get_max_size()
Returns:

Database max file size

Return type:

int

Get the maximum size for the database file storage

This method returns the currently configured max database file size. A return value of zero indicates that no limit is configured.

Added in version 3.8.

set_max_size(max_size)
Parameters:

max_size (int) – Max database file size, in bytes error A GLib.Error

Raises:

GLib.Error

Returns:

True is configuration was successful, otherwise False and error will be set.

Return type:

bool

Set the maximum size for the database file storage

If max_size is 0, it means “no limit”, in which case the database file size will be limited only by the database capabilities / intrinsic limits.

If max_size has a higher limit than supported by the database, the max_size will be internally set to the limit supported by the database.

The max_size will be internally truncated to a multiple of the database page size. If the page size is, for example, 4K, setting a max size of 10K will effectively limit the database size to 8K to ensure it does not grow beyond the specified limit.

Attempting to set a limit that is less than the already used database file storage will NOT truncate the database, but won’t allow the database to grow further in size (although writes might be still accepted within the already allocated space).

This value does not persist in the database. Each construction of this class must set the property again or it will use the default value.

Added in version 3.8.

Property Details

Soup.CookieJarDB.props.filename
Name:

filename

Type:

str

Default Value:

None

Flags:

READABLE, WRITABLE, CONSTRUCT_ONLY

Cookie-storage filename.

Soup.CookieJarDB.props.max_size
Name:

max-size

Type:

int

Default Value:

0

Flags:

READABLE, WRITABLE, CONSTRUCT_ONLY, EXPLICIT_NOTIFY

Cookie-storage maximum database size.

Added in version 3.8.