Storage

This CDP domain is experimental.

Types

Generally, you do not need to instantiate CDP types yourself. Instead, the API creates objects for you as return values from commands, and then you can use those objects as arguments to other commands.

class cdp.storage.StorageType

Enum of possible storage types.

ALL_ = 'all'
APPCACHE = 'appcache'
CACHE_STORAGE = 'cache_storage'
COOKIES = 'cookies'
FILE_SYSTEMS = 'file_systems'
INDEXEDDB = 'indexeddb'
LOCAL_STORAGE = 'local_storage'
OTHER = 'other'
SERVICE_WORKERS = 'service_workers'
SHADER_CACHE = 'shader_cache'
WEBSQL = 'websql'
class cdp.storage.UsageForType(storage_type, usage)

Usage for a storage type.

storage_type = None

Name of storage type.

usage = None

Storage usage (bytes).

Commands

Each command is a generator function. The return type Generator[x, y, z] indicates that the generator yields arguments of type x, it must be resumed with an argument of type y, and it returns type z. In this library, types x and y are the same for all commands, and z is the return type you should pay attention to. For more information, see Getting Started: Commands.

cdp.storage.clear_data_for_origin(origin, storage_types)

Clears storage for origin.

Parameters:
  • origin (str) – Security origin.
  • storage_types (str) – Comma separated list of StorageType to clear.
Return type:

Generator[Dict[str, Any], Dict[str, Any], None]

cdp.storage.get_usage_and_quota(origin)

Returns usage and quota in bytes.

Parameters:origin (str) – Security origin.
Return type:Generator[Dict[str, Any], Dict[str, Any], Tuple[float, float, List[UsageForType]]]
Returns:A tuple with the following items:
  1. usage - Storage usage (bytes).
  2. quota - Storage quota (bytes).
  3. usageBreakdown - Storage usage per type (bytes).
cdp.storage.track_cache_storage_for_origin(origin)

Registers origin to be notified when an update occurs to its cache storage list.

Parameters:origin (str) – Security origin.
Return type:Generator[Dict[str, Any], Dict[str, Any], None]
cdp.storage.track_indexed_db_for_origin(origin)

Registers origin to be notified when an update occurs to its IndexedDB.

Parameters:origin (str) – Security origin.
Return type:Generator[Dict[str, Any], Dict[str, Any], None]
cdp.storage.untrack_cache_storage_for_origin(origin)

Unregisters origin from receiving notifications for cache storage.

Parameters:origin (str) – Security origin.
Return type:Generator[Dict[str, Any], Dict[str, Any], None]
cdp.storage.untrack_indexed_db_for_origin(origin)

Unregisters origin from receiving notifications for IndexedDB.

Parameters:origin (str) – Security origin.
Return type:Generator[Dict[str, Any], Dict[str, Any], None]

Events

Generally, you do not need to instantiate CDP events yourself. Instead, the API creates events for you and then you use the event’s attributes.

class cdp.storage.CacheStorageContentUpdated(origin, cache_name)

A cache’s contents have been modified.

cache_name = None

Name of cache in origin.

origin = None

Origin to update.

class cdp.storage.CacheStorageListUpdated(origin)

A cache has been added/deleted.

origin = None

Origin to update.

class cdp.storage.IndexedDBContentUpdated(origin, database_name, object_store_name)

The origin’s IndexedDB object store has been modified.

database_name = None

Database to update.

object_store_name = None

ObjectStore to update.

origin = None

Origin to update.

class cdp.storage.IndexedDBListUpdated(origin)

The origin’s IndexedDB database list has been modified.

origin = None

Origin to update.