squid_py.ocean.ocean module

Ocean module.

class squid_py.ocean.ocean.Ocean(config=None)

Bases: object

The Ocean class is the entry point into Ocean Protocol.

property config
consume_service(*args, **kwargs)

Consume the asset data.

Using the service endpoint defined in the ddo’s service pointed to by service_definition_id. Consumer’s permissions is checked implicitly by the secret-store during decryption of the contentUrls. The service endpoint is expected to also verify the consumer’s permissions to consume this asset. This method downloads and saves the asset datafiles to disk.

Returns

None

execute_service_agreement(*args, **kwargs)

Execute the service agreement on-chain using keeper’s ServiceExecutionAgreement contract.

The on-chain initializeAgreement method requires the following arguments: templateId, signature, consumer, hashes, timeouts, serviceAgreementId, did. agreement_message_hash is necessary to verify the signature. The consumer signature includes the conditions timeouts and parameters values which is usedon-chain to verify that the values actually match the signed hashes.

Returns

dict the initializeAgreement transaction receipt

get_accounts()

Returns all available accounts loaded via a wallet, or by Web3.

Returns

list of Account instances

is_access_granted(*args, **kwargs)

Check permission for the agreement.

Verify on-chain that the consumer_address has permission to access the given asset did according to the service_agreement_id.

Returns

bool True if user has permission

property keeper

Keeper instance.

purchase_asset_service(*args, **kwargs)

Sign service agreement.

Sign the service agreement defined in the service section identified by service_definition_id in the ddo and send the signed agreement to the purchase endpoint associated with this service.

Returns

tuple(agreement_id, signature) the service agreement id (can be used to query the keeper-contracts for the status of the service agreement) and signed agreement hash

register_asset(*args, **kwargs)

Register an asset in both the keeper’s DIDRegistry (on-chain) and in the Metadata store ( Aquarius).

See OceanAssets.query for params

Returns

DDO instance

resolve_asset_did(did)

When you pass a did retrieve the ddo associated.

Parameters

did – DID, str

Returns

DDO

search_assets(*args, **kwargs)

Search an asset in oceanDB using search query.

See OceanAssets.query for params

Returns

List of assets that match with the query.

search_assets_by_text(*args, **kwargs)

Search an asset in oceanDB using aquarius.

see OceanAssets.search for params

Returns

List of assets that match with the query