Client Interface

The main Client class extends an autogenerated IPFS Interface class that is built by introspecting the GO IPFS library’s API. All of the methods in the IPFS Interface are available in the Client.

Client

The Client can be either used within an asynchronous context:

async with Client() as client:
    # print the readme
    async with client.cat("QmYwAPJzv5CZsnA625s3Xf2nemtYgPpHdWEz79ojWnPbdG/readme") as f:
        print(await f.text())

Or explicitly opened/closed:

client = Client()
await client.connect()
async with client.cat("QmYwAPJzv5CZsnA625s3Xf2nemtYgPpHdWEz79ojWnPbdG/readme") as f:
    print(await f.text())
await client.close()

IPFS Interface

This class is autogenerated by the code in the go folder. It uses the IPFS go library and introspection to autogenerate the Python code.

class aioipfs_api.autoapi.IPFSInterface(client)[source]

Autogenerated interface to the IPFS HTTP API version 0.4.15

VERSION = '0.4.15'
add(path, **kwargs)[source]

Add a file or directory to ipfs.

Parameters:
  • path – The path to a file to be added to ipfs. (string)
  • recursive – Add directory paths recursively. (bool) Default: False
  • quiet – Write minimal output. (bool) Default: False
  • quieter – Write only final hash. (bool) Default: False
  • silent – Write no output. (bool) Default: False
  • progress – Stream progress data. (bool) Default: False
  • trickle – Use trickle-dag format for dag generation. (bool) Default: False
  • only_hashname – Only chunk and hash - do not write to disk. (bool) Default: False
  • wrap_with_directory – Wrap files with a directory object. (bool) Default: False
  • hidden – Include files that are hidden. Only takes effect on recursive add. (bool) Default: False
  • chunker – Chunking algorithm, size-[bytes] or rabin-[min]-[avg]-[max]. (string) Default: size-262144
  • pin – Pin this object when adding. (bool) Default: True
  • raw_leaves – Use raw blocks for leaf nodes. (experimental). (bool) Default: False
  • nocopy – Add the file using filestore. Implies raw-leaves. (experimental). (bool) Default: False
  • fscache – Check the filestore for pre-existing blocks. (experimental). (bool) Default: False
  • cid_version – CID version. Defaults to 0 unless an option that depends on CIDv1 is passed. (experimental). (int) Default: 0
  • hashname – Hash function to use. Implies CIDv1 if not sha2-256. (experimental). (string) Default: sha2-256
Returns:

A parsed dict result of:

{
    "Name": "<string>"
    "Hash": "<string>"
    "Bytes": "<int64>"
    "Size": "<string>"
}

bitswap_ledger(peer, **kwargs)[source]

Show the current ledger for a peer.

Parameters:peer – The PeerID (B58) of the ledger to inspect. (string)
Returns:A parsed dict result of:
{
    "Peer": "<string>"
    "Value": "<float64>"
    "Sent": "<uint64>"
    "Recv": "<uint64>"
    "Exchanged": "<uint64>"
}
bitswap_reprovide(**kwargs)[source]

Trigger reprovider.

Returns:A aiohttp.ClientResponse object that can be read like a file.
bitswap_stat(**kwargs)[source]

Show some diagnostic information on the bitswap agent.

Returns:A parsed dict result of:
{
    "ProvideBufLen": "<int>"
    "Wantlist": [
        "<string>"
    ]
    "Peers": [
        "<string>"
    ]
    "BlocksReceived": "<uint64>"
    "DataReceived": "<uint64>"
    "BlocksSent": "<uint64>"
    "DataSent": "<uint64>"
    "DupBlksReceived": "<uint64>"
    "DupDataReceived": "<uint64>"
}
bitswap_unwant(key, **kwargs)[source]

Remove a given block from your wantlist.

Parameters:key – Key(s) to remove from your wantlist. (string)
Returns:A aiohttp.ClientResponse object that can be read like a file.
bitswap_wantlist(**kwargs)[source]

Show blocks currently on the wantlist.

Parameters:peer – Specify which peer to show wantlist for. (string) Default: “”
Returns:A parsed dict result of:
{
    "Keys": [
        "<string>"
    ]
}
block_get(key, **kwargs)[source]

Get a raw IPFS block.

Parameters:key – The base58 multihash of an existing block to get. (string)
Returns:A aiohttp.ClientResponse object that can be read like a file.
block_put(data, **kwargs)[source]

Store input as an IPFS block.

Parameters:
  • data – The data to be stored as an IPFS block. (string)
  • format – cid format for blocks to be created with. (string) Default: “”
  • mhtype – multihash hash function. (string) Default: sha2-256
  • mhlen – multihash hash length. (int) Default: -1
Returns:

A parsed dict result of:

{
    "Key": "<string>"
    "Size": "<int>"
}

block_rm(hashname, **kwargs)[source]

Remove IPFS block(s).

Parameters:
  • hashname – Bash58 encoded multihash of block(s) to remove. (string)
  • force – Ignore nonexistent blocks. (bool) Default: False
  • quiet – Write minimal output. (bool) Default: False
Returns:

A parsed dict result of:

{
    "Hash": "<string>"
    "Error": "<string>"
}

block_stat(key, **kwargs)[source]

Print information of a raw IPFS block.

Parameters:key – The base58 multihash of an existing block to stat. (string)
Returns:A parsed dict result of:
{
    "Key": "<string>"
    "Size": "<int>"
}
bootstrap_add_default(**kwargs)[source]

Add default peers to the bootstrap list.

Returns:A parsed dict result of:
{
    "Peers": [
        "<string>"
    ]
}
bootstrap_list(**kwargs)[source]

Show peers in the bootstrap list.

Returns:A parsed dict result of:
{
    "Peers": [
        "<string>"
    ]
}
bootstrap_rm_all(**kwargs)[source]

Remove all peers from the bootstrap list.

Returns:A parsed dict result of:
{
    "Peers": [
        "<string>"
    ]
}
cat(ipfs_path, **kwargs)[source]

Show IPFS object data.

Parameters:
  • ipfs_path – The path to the IPFS object(s) to be outputted. (string)
  • offset – Byte offset to begin reading from. (int) Default: 0
  • length – Maximum number of bytes to read. (int) Default: 0
Returns:

A aiohttp.ClientResponse object that can be read like a file.

commands(**kwargs)[source]

List all available commands.

Parameters:flags – Show command flags. (bool) Default: False
Returns:A parsed dict result of:
{
    "Name": "<string>"
    "Subcommands": [
        {
            "Name": "<string>"
            "Subcommands": [
                {
                    "Name": "<string>"
                    "Subcommands": [
                        ...
                    ]
                    "Options": [
                        ...
                    ]
                    "showOpts": "<bool>"
                }
            ]
            "Options": [
                {
                    "Names": [
                        ...
                    ]
                }
            ]
            "showOpts": "<bool>"
        }
    ]
    "Options": [
        {
            "Names": [
                "<string>"
            ]
        }
    ]
    "showOpts": "<bool>"
}
config_edit(**kwargs)[source]

Open the config file for editing in $EDITOR.

Returns:A aiohttp.ClientResponse object that can be read like a file.
config_profile_apply(profile, **kwargs)[source]

Apply profile to config.

Parameters:profile – The profile to apply to the config. (string)
Returns:A aiohttp.ClientResponse object that can be read like a file.
config_replace(file, **kwargs)[source]

Replace the config with <file>.

Parameters:file – The file to use as the new config. (string)
Returns:A aiohttp.ClientResponse object that can be read like a file.
config_show(**kwargs)[source]

Output config file contents.

Returns:A aiohttp.ClientResponse object that can be read like a file.
dag_get(ref, **kwargs)[source]

Get a dag node from ipfs.

Parameters:ref – The object to get (string)
Returns:A aiohttp.ClientResponse object that can be read like a file.
dag_put(object_data, **kwargs)[source]

Add a dag node to ipfs.

Parameters:
  • object_data – The object to put (string)
  • format – Format that the object will be added as. (string) Default: cbor
  • input_enc – Format that the input object will be. (string) Default: json
  • pin – Pin this object when adding. (bool) Default: False
  • hashname – Hash function to use. Default: . (string) Default: “”
Returns:

A parsed dict result of:

{
    "Cid": "<string>"
}

dag_resolve(ref, **kwargs)[source]

Resolve ipld block

Parameters:ref – The path to resolve (string)
Returns:A parsed dict result of:
{
    "Cid": "<string>"
    "RemPath": "<string>"
}
dht_findpeer(peerid, **kwargs)[source]

Query the DHT for all of the multiaddresses associated with a Peer ID.

Parameters:
  • peerid – The ID of the peer to search for. (string)
  • verbose – Print extra information. (bool) Default: False
Returns:

A parsed dict result of:

{
    "ID": "<string>"
    "Type": "<int>"
    "Responses": [
        {
            "ID": "<string>"
            "Addrs": [
                "<object>"
            ]
        }
    ]
    "Extra": "<string>"
}

dht_findprovs(key, **kwargs)[source]

Find peers in the DHT that can provide a specific value, given a key.

Parameters:
  • key – The key to find providers for. (string)
  • verbose – Print extra information. (bool) Default: False
  • num_providers – The number of providers to find. (int) Default: 20
Returns:

A parsed dict result of:

{
    "ID": "<string>"
    "Type": "<int>"
    "Responses": [
        {
            "ID": "<string>"
            "Addrs": [
                "<object>"
            ]
        }
    ]
    "Extra": "<string>"
}

dht_get(key, **kwargs)[source]

Given a key, query the DHT for its best value.

Parameters:
  • key – The key to find a value for. (string)
  • verbose – Print extra information. (bool) Default: False
Returns:

A parsed dict result of:

{
    "ID": "<string>"
    "Type": "<int>"
    "Responses": [
        {
            "ID": "<string>"
            "Addrs": [
                "<object>"
            ]
        }
    ]
    "Extra": "<string>"
}

dht_provide(key, **kwargs)[source]

Announce to the network that you are providing given values.

Parameters:
  • key – The key[s] to send provide records for. (string)
  • verbose – Print extra information. (bool) Default: False
  • recursive – Recursively provide entire graph. (bool) Default: False
Returns:

A parsed dict result of:

{
    "ID": "<string>"
    "Type": "<int>"
    "Responses": [
        {
            "ID": "<string>"
            "Addrs": [
                "<object>"
            ]
        }
    ]
    "Extra": "<string>"
}

dht_put(key, value, **kwargs)[source]

Write a key/value pair to the DHT.

Parameters:
  • key – The key to store the value at. (string)
  • value – The value to store. (string)
  • verbose – Print extra information. (bool) Default: False
Returns:

A parsed dict result of:

{
    "ID": "<string>"
    "Type": "<int>"
    "Responses": [
        {
            "ID": "<string>"
            "Addrs": [
                "<object>"
            ]
        }
    ]
    "Extra": "<string>"
}

dht_query(peerid, **kwargs)[source]

Find the closest Peer IDs to a given Peer ID by querying the DHT.

Parameters:
  • peerid – The peerID to run the query against. (string)
  • verbose – Print extra information. (bool) Default: False
Returns:

A parsed dict result of:

{
    "ID": "<string>"
    "Type": "<int>"
    "Responses": [
        {
            "ID": "<string>"
            "Addrs": [
                "<object>"
            ]
        }
    ]
    "Extra": "<string>"
}

diag_cmds_clear(**kwargs)[source]

Clear inactive requests from the log.

Returns:A aiohttp.ClientResponse object that can be read like a file.
diag_cmds_set_time(time, **kwargs)[source]

Set how long to keep inactive requests in the log.

Parameters:time – Time to keep inactive requests in log. (string)
Returns:A aiohttp.ClientResponse object that can be read like a file.
diag_sys(**kwargs)[source]

Print system diagnostic information.

Returns:A aiohttp.ClientResponse object that can be read like a file.
dns(domain_name, **kwargs)[source]

Resolve DNS links.

Parameters:
  • domain_name – The domain-name name to resolve. (string)
  • recursive – Resolve until the result is not a DNS link. (bool) Default: False
Returns:

A parsed dict result of:

{
    "Path": "<string>"
}

file_ls(ipfs_path, **kwargs)[source]

List directory contents for Unix filesystem objects.

Parameters:ipfs_path – The path to the IPFS object(s) to list links from. (string)
Returns:A parsed dict result of:
{
    "Arguments": {
        "<string>": "<string>"
    }
    "Objects": {
        "<string>": {
            "Hash": "<string>"
            "Size": "<uint64>"
            "Type": "<string>"
            "Links": [
                {
                    "Name": "<string>"
                    "Hash": "<string>"
                    "Size": "<uint64>"
                    "Type": "<string>"
                }
            ]
        }
    }
}
files_chcid(**kwargs)[source]

Change the cid version or hash function of the root node of a given path.

Parameters:
  • path – Path to change. Default: ‘/’. (string) Default: “”
  • cid_version – Cid version to use. (experimental). (int) Default: 0
  • hashname – Hash function to use. Will set Cid version to 1 if used. (experimental). (string) Default: “”
Returns:

A aiohttp.ClientResponse object that can be read like a file.

files_cp(source, dest, **kwargs)[source]

Copy files into mfs.

Parameters:
  • source – Source object to copy. (string)
  • dest – Destination to copy object to. (string)
Returns:

A aiohttp.ClientResponse object that can be read like a file.

files_flush(**kwargs)[source]

Flush a given path’s data to disk.

Parameters:path – Path to flush. Default: ‘/’. (string) Default: “”
Returns:A aiohttp.ClientResponse object that can be read like a file.
files_ls(**kwargs)[source]

List directories in the local mutable namespace.

Parameters:
  • path – Path to show listing for. Defaults to ‘/’. (string) Default: “”
  • l – Use long listing format. (bool) Default: False
Returns:

A parsed dict result of:

{
    "Entries": [
        {
            "Name": "<string>"
            "Type": "<int>"
            "Size": "<int64>"
            "Hash": "<string>"
        }
    ]
}

files_mkdir(path, **kwargs)[source]

Make directories.

Parameters:
  • path – Path to dir to make. (string)
  • parents – No error if existing, make parent directories as needed. (bool) Default: False
  • cid_version – Cid version to use. (experimental). (int) Default: 0
  • hashname – Hash function to use. Will set Cid version to 1 if used. (experimental). (string) Default: “”
Returns:

A aiohttp.ClientResponse object that can be read like a file.

files_mv(source, dest, **kwargs)[source]

Move files.

Parameters:
  • source – Source file to move. (string)
  • dest – Destination path for file to be moved to. (string)
Returns:

A aiohttp.ClientResponse object that can be read like a file.

files_read(path, **kwargs)[source]

Read a file in a given mfs.

Parameters:
  • path – Path to file to be read. (string)
  • offset – Byte offset to begin reading from. (int) Default: 0
  • count – Maximum number of bytes to read. (int) Default: 0
Returns:

A aiohttp.ClientResponse object that can be read like a file.

files_rm(path, **kwargs)[source]

Remove a file.

Parameters:
  • path – File to remove. (string)
  • recursive – Recursively remove directories. (bool) Default: False
Returns:

A aiohttp.ClientResponse object that can be read like a file.

files_stat(path, **kwargs)[source]

Display file status.

Parameters:
  • path – Path to node to stat. (string)
  • format – Print statistics in given format. Allowed tokens: <hash> <size> <cumulsize> <type> <childs>. Conflicts with other format options. Default: <hash> Size: <size> CumulativeSize: <cumulsize> ChildBlocks: <childs> Type: <type>. (string) Default: <hash> Size: <size> CumulativeSize: <cumulsize> ChildBlocks: <childs> Type: <type>
  • hashname – Print only hash. Implies ‘–format=<hash>’. Conflicts with other format options. (bool) Default: False
  • size – Print only size. Implies ‘–format=<cumulsize>’. Conflicts with other format options. (bool) Default: False
  • with_local – Compute the amount of the dag that is local, and if possible the total size. (bool) Default: False
Returns:

A parsed dict result of:

{
    "Hash": "<string>"
    "Size": "<uint64>"
    "CumulativeSize": "<uint64>"
    "Blocks": "<int>"
    "Type": "<string>"
    "WithLocality": "<bool>"
    "Local": "<bool>"
    "SizeLocal": "<uint64>"
}

files_write(path, data, **kwargs)[source]

Write to a mutable file in a given filesystem.

Parameters:
  • path – Path to write to. (string)
  • data – Data to write. (string)
  • offset – Byte offset to begin writing at. (int) Default: 0
  • create – Create the file if it does not exist. (bool) Default: False
  • truncate – Truncate the file to size zero before writing. (bool) Default: False
  • count – Maximum number of bytes to read. (int) Default: 0
  • raw_leaves – Use raw blocks for newly created leaf nodes. (experimental). (bool) Default: False
  • cid_version – Cid version to use. (experimental). (int) Default: 0
  • hashname – Hash function to use. Will set Cid version to 1 if used. (experimental). (string) Default: “”
Returns:

A aiohttp.ClientResponse object that can be read like a file.

filestore_dups(**kwargs)[source]

List blocks that are both in the filestore and standard block storage.

Returns:A parsed dict result of:
{
    "Ref": "<string>"
    "Err": "<string>"
}
filestore_ls(**kwargs)[source]

List objects in filestore.

Parameters:
  • obj – Cid of objects to list. (string) Default: “”
  • file_order – sort the results based on the path of the backing file. (bool) Default: False
Returns:

A parsed dict result of:

{
    "Status": "<int32>"
    "ErrorMsg": "<string>"
    "Key": "<string>"
    "FilePath": "<string>"
    "Offset": "<uint64>"
    "Size": "<uint64>"
}

filestore_verify(**kwargs)[source]

Verify objects in filestore.

Parameters:
  • obj – Cid of objects to verify. (string) Default: “”
  • file_order – verify the objects based on the order of the backing file. (bool) Default: False
Returns:

A parsed dict result of:

{
    "Status": "<int32>"
    "ErrorMsg": "<string>"
    "Key": "<string>"
    "FilePath": "<string>"
    "Offset": "<uint64>"
    "Size": "<uint64>"
}

get(ipfs_path, **kwargs)[source]

Download IPFS objects.

Parameters:
  • ipfs_path – The path to the IPFS object(s) to be outputted. (string)
  • output – The path where the output should be stored. (string) Default: “”
  • archive – Output a TAR archive. (bool) Default: False
  • compress – Compress the output with GZIP compression. (bool) Default: False
  • compression_level – The level of compression (1-9). (int) Default: 0
Returns:

A aiohttp.ClientResponse object that can be read like a file.

id(**kwargs)[source]

Show ipfs node id info.

Parameters:
  • peerid – Peer.ID of node to look up. (string) Default: “”
  • format – Optional output format. (string) Default: “”
Returns:

A parsed dict result of:

{
    "ID": "<string>"
    "PublicKey": "<string>"
    "Addresses": [
        "<string>"
    ]
    "AgentVersion": "<string>"
    "ProtocolVersion": "<string>"
}

key_gen(name, **kwargs)[source]

Create a new keypair

Parameters:
  • name – name of key to create (string)
  • type – type of the key to create [rsa, ed25519]. (string) Default: “”
  • size – size of the key to generate. (int) Default: 0
Returns:

A parsed dict result of:

{
    "Name": "<string>"
    "Id": "<string>"
}

key_list(**kwargs)[source]

List all local keypairs

Parameters:l – Show extra information about keys. (bool) Default: False
Returns:A parsed dict result of:
{
    "Keys": [
        {
            "Name": "<string>"
            "Id": "<string>"
        }
    ]
}
key_rename(name, newname, **kwargs)[source]

Rename a keypair

Parameters:
  • name – name of key to rename (string)
  • newname – new name of the key (string)
  • force – Allow to overwrite an existing key. (bool) Default: False
Returns:

A parsed dict result of:

{
    "Was": "<string>"
    "Now": "<string>"
    "Id": "<string>"
    "Overwrite": "<bool>"
}

key_rm(name, **kwargs)[source]

Remove a keypair

Parameters:
  • name – names of keys to remove (string)
  • l – Show extra information about keys. (bool) Default: False
Returns:

A parsed dict result of:

{
    "Keys": [
        {
            "Name": "<string>"
            "Id": "<string>"
        }
    ]
}

log_level(subsystem, level, **kwargs)[source]

Change the logging level.

Parameters:
  • subsystem – The subsystem logging identifier. Use ‘all’ for all subsystems. (string)
  • level
    The log level, with ‘debug’ the most verbose and ‘critical’ the least verbose.
    One of: debug, info, warning, error, critical.

    (string)

Returns:

A parsed dict result of:

{
    "Message": "<string>"
}

log_ls(**kwargs)[source]

List the logging subsystems.

Returns:A parsed dict result of:
{
    "Strings": [
        "<string>"
    ]
}
log_tail(**kwargs)[source]

Read the event log.

Returns:A aiohttp.ClientResponse object that can be read like a file.
ls(ipfs_path, **kwargs)[source]

List directory contents for Unix filesystem objects.

Parameters:
  • ipfs_path – The path to the IPFS object(s) to list links from. (string)
  • headers – Print table headers (Hash, Size, Name). (bool) Default: False
  • resolve_type – Resolve linked objects to find out their types. (bool) Default: True
Returns:

A parsed dict result of:

{
    "Objects": [
        {
            "Hash": "<string>"
            "Links": [
                {
                    "Name": "<string>"
                    "Hash": "<string>"
                    "Size": "<uint64>"
                    "Type": "<int32>"
                }
            ]
        }
    ]
}

mount(**kwargs)[source]

Mounts IPFS to the filesystem (read-only).

Parameters:
  • ipfs_path – The path where IPFS should be mounted. (string) Default: “”
  • ipns_path – The path where IPNS should be mounted. (string) Default: “”
Returns:

A parsed dict result of:

{
    "IPFS": "<string>"
    "IPNS": "<string>"
    "FuseAllowOther": "<bool>"
}

name_publish(ipfs_path, **kwargs)[source]

Publish IPNS names.

Parameters:
  • ipfs_path – ipfs path of the object to be published. (string)
  • resolve – Resolve given path before publishing. (bool) Default: True
  • lifetime – Time duration that the record will be valid for. This accepts durations such as “300s”, “1.5h” or “2h45m”. Valid time units are “ns”, “us” (or “µs”), “ms”, “s”, “m”, “h”. (string) Default: 24h
  • ttl – Time duration this record should be cached for (caution: experimental). (string) Default: “”
  • key – Name of the key to be used or a valid PeerID, as listed by ‘ipfs key list -l’. Default:. (string) Default: self
Returns:

A parsed dict result of:

{
    "Name": "<string>"
    "Value": "<string>"
}

name_pubsub_cancel(name, **kwargs)[source]

Cancel a name subscription

Parameters:name – Name to cancel the subscription for. (string)
Returns:A parsed dict result of:
{
    "Canceled": "<bool>"
}
name_pubsub_state(**kwargs)[source]

Query the state of IPNS pubsub

Returns:A parsed dict result of:
{
    "Enabled": "<bool>"
}
name_pubsub_subs(**kwargs)[source]

Show current name subscriptions

Returns:A parsed dict result of:
{
    "Strings": [
        "<string>"
    ]
}
name_resolve(**kwargs)[source]

Resolve IPNS names.

Parameters:
  • name – The IPNS name to resolve. Defaults to your node’s peerID. (string) Default: “”
  • recursive – Resolve until the result is not an IPNS name. (bool) Default: False
  • nocache – Do not use cached entries. (bool) Default: False
  • dht_record_count – Number of records to request for DHT resolution. (uint) Default: 0
  • dht_timeout – Max time to collect values during DHT resolution eg “30s”. Pass 0 for no timeout. (string) Default: “”
Returns:

A parsed dict result of:

{
    "Path": "<string>"
}

object_data(key, **kwargs)[source]

Output the raw bytes of an IPFS object.

Parameters:key – Key of the object to retrieve, in base58-encoded multihash format. (string)
Returns:A aiohttp.ClientResponse object that can be read like a file.
object_diff(obj_a, obj_b, **kwargs)[source]

Display the diff between two ipfs objects.

Parameters:
  • obj_a – Object to diff against. (string)
  • obj_b – Object to diff. (string)
  • verbose – Print extra information. (bool) Default: False
Returns:

A parsed dict result of:

{
    "Changes": [
        {
            "Type": "<int>"
            "Path": "<string>"
            "Before": "<string>"
            "After": "<string>"
        }
    ]
}

object_get(key, **kwargs)[source]

Get and serialize the DAG node named by <key>.

Parameters:key – Key of the object to retrieve, in base58-encoded multihash format. (string)
Returns:A parsed dict result of:
{
    "Links": [
        {
            "Name": "<string>"
            "Hash": "<string>"
            "Size": "<uint64>"
        }
    ]
    "Data": "<string>"
}

Output the links pointed to by the specified object.

Parameters:
  • key – Key of the object to retrieve, in base58-encoded multihash format. (string)
  • headers – Print table headers (Hash, Size, Name). (bool) Default: False
Returns:

A parsed dict result of:

{
    "Hash": "<string>"
    "Links": [
        {
            "Name": "<string>"
            "Hash": "<string>"
            "Size": "<uint64>"
        }
    ]
}

object_new(**kwargs)[source]

Create a new object from an ipfs template.

Parameters:template – Template to use. Optional. (string) Default: “”
Returns:A parsed dict result of:
{
    "Hash": "<string>"
    "Links": [
        {
            "Name": "<string>"
            "Hash": "<string>"
            "Size": "<uint64>"
        }
    ]
}

Add a link to a given object.

Parameters:
  • root – The hash of the node to modify. (string)
  • name – Name of link to create. (string)
  • ref – IPFS object to add link to. (string)
  • create – Create intermediary nodes. (bool) Default: False
Returns:

A parsed dict result of:

{
    "Hash": "<string>"
    "Links": [
        {
            "Name": "<string>"
            "Hash": "<string>"
            "Size": "<uint64>"
        }
    ]
}

object_patch_append_data(root, data, **kwargs)[source]

Append data to the data segment of a dag node.

Parameters:
  • root – The hash of the node to modify. (string)
  • data – Data to append. (string)
Returns:

A parsed dict result of:

{
    "Hash": "<string>"
    "Links": [
        {
            "Name": "<string>"
            "Hash": "<string>"
            "Size": "<uint64>"
        }
    ]
}

Remove a link from an object.

Parameters:
  • root – The hash of the node to modify. (string)
  • link – Name of the link to remove. (string)
Returns:

A parsed dict result of:

{
    "Hash": "<string>"
    "Links": [
        {
            "Name": "<string>"
            "Hash": "<string>"
            "Size": "<uint64>"
        }
    ]
}

object_patch_set_data(root, data, **kwargs)[source]

Set the data field of an IPFS object.

Parameters:
  • root – The hash of the node to modify. (string)
  • data – The data to set the object to. (string)
Returns:

A parsed dict result of:

{
    "Hash": "<string>"
    "Links": [
        {
            "Name": "<string>"
            "Hash": "<string>"
            "Size": "<uint64>"
        }
    ]
}

object_put(data, **kwargs)[source]

Store input as a DAG object, print its key.

Parameters:
  • data – Data to be stored as a DAG object. (string)
  • inputenc – Encoding type of input data. One of: {“protobuf”, “json”}. (string) Default: json
  • datafieldenc – Encoding type of the data field, either “text” or “base64”. (string) Default: text
  • pin – Pin this object when adding. (bool) Default: False
  • quiet – Write minimal output. (bool) Default: False
Returns:

A parsed dict result of:

{
    "Hash": "<string>"
    "Links": [
        {
            "Name": "<string>"
            "Hash": "<string>"
            "Size": "<uint64>"
        }
    ]
}

object_stat(key, **kwargs)[source]

Get stats for the DAG node named by <key>.

Parameters:key – Key of the object to retrieve, in base58-encoded multihash format. (string)
Returns:A parsed dict result of:
{
    "Hash": "<string>"
    "NumLinks": "<int>"
    "BlockSize": "<int>"
    "LinksSize": "<int>"
    "DataSize": "<int>"
    "CumulativeSize": "<int>"
}
p2p_listener_close(**kwargs)[source]

Close active p2p listener.

Parameters:
  • protocol – P2P listener protocol (string) Default: “”
  • all – Close all listeners. (bool) Default: False
Returns:

A aiohttp.ClientResponse object that can be read like a file.

p2p_listener_ls(**kwargs)[source]

List active p2p listeners.

Parameters:headers – Print table headers (HandlerID, Protocol, Local, Remote). (bool) Default: False
Returns:A parsed dict result of:
{
    "Listeners": [
        {
            "Protocol": "<string>"
            "Address": "<string>"
        }
    ]
}
p2p_listener_open(protocol, address, **kwargs)[source]

Forward p2p connections to a network multiaddr.

Parameters:
  • protocol – Protocol identifier. (string)
  • address – Request handling application address. (string)
Returns:

A aiohttp.ClientResponse object that can be read like a file.

p2p_stream_close(**kwargs)[source]

Close active p2p stream.

Parameters:
  • handlerid – Stream HandlerID (string) Default: “”
  • all – Close all streams. (bool) Default: False
Returns:

A aiohttp.ClientResponse object that can be read like a file.

p2p_stream_dial(peer, protocol, **kwargs)[source]

Dial to a p2p listener.

Parameters:
  • peer – Remote peer to connect to (string)
  • protocol – Protocol identifier. (string)
  • bindaddress – Address to listen for connection/s (default: /ip4/127.0.0.1/tcp/0). (string) Default: “”
Returns:

A aiohttp.ClientResponse object that can be read like a file.

p2p_stream_ls(**kwargs)[source]

List active p2p streams.

Parameters:headers – Print table headers (HagndlerID, Protocol, Local, Remote). (bool) Default: False
Returns:A parsed dict result of:
{
    "Streams": [
        {
            "HandlerID": "<string>"
            "Protocol": "<string>"
            "LocalPeer": "<string>"
            "LocalAddress": "<string>"
            "RemotePeer": "<string>"
            "RemoteAddress": "<string>"
        }
    ]
}
pin_add(ipfs_path, **kwargs)[source]

Pin objects to local storage.

Parameters:
  • ipfs_path – Path to object(s) to be pinned. (string)
  • recursive – Recursively pin the object linked to by the specified object(s). (bool) Default: True
  • progress – Show progress. (bool) Default: False
Returns:

A parsed dict result of:

{
    "Pins": [
        "<string>"
    ]
    "Progress": "<int>"
}

pin_ls(**kwargs)[source]

List objects pinned to local storage.

Parameters:
  • ipfs_path – Path to object(s) to be listed. (string) Default: “”
  • type – The type of pinned keys to list. Can be “direct”, “indirect”, “recursive”, or “all”. (string) Default: all
  • quiet – Write just hashes of objects. (bool) Default: False
Returns:

A parsed dict result of:

{
    "Keys": {
        "<string>": {
            "Type": "<string>"
        }
    }
}

pin_rm(ipfs_path, **kwargs)[source]

Remove pinned objects from local storage.

Parameters:
  • ipfs_path – Path to object(s) to be unpinned. (string)
  • recursive – Recursively unpin the object linked to by the specified object(s). (bool) Default: True
Returns:

A parsed dict result of:

{
    "Pins": [
        "<string>"
    ]
}

pin_update(from_path, to_path, **kwargs)[source]

Update a recursive pin

Parameters:
  • from_path – Path to old object. (string)
  • to_path – Path to new object to be pinned. (string)
  • unpin – Remove the old pin. (bool) Default: True
Returns:

A parsed dict result of:

{
    "Pins": [
        "<string>"
    ]
}

pin_verify(**kwargs)[source]

Verify that recursive pins are complete.

Parameters:
  • verbose – Also write the hashes of non-broken pins. (bool) Default: False
  • quiet – Write just hashes of broken pins. (bool) Default: False
Returns:

A parsed dict result of:

{
    "Cid": "<string>"
    "PinStatus": {
        "Ok": "<bool>"
        "BadNodes": [
            {
                "Cid": "<string>"
                "Err": "<string>"
            }
        ]
    }
}

ping(peer_id, **kwargs)[source]

Send echo request packets to IPFS hosts.

Parameters:
  • peer_id – ID of peer to be pinged. (string)
  • count – Number of ping messages to send. (int) Default: 10
Returns:

A parsed dict result of:

{
    "Success": "<bool>"
    "Time": "<int64>"
    "Text": "<string>"
}

pubsub_ls(**kwargs)[source]

List subscribed topics by name.

Returns:A parsed dict result of:
{
    "Strings": [
        "<string>"
    ]
}
pubsub_peers(**kwargs)[source]

List peers we are currently pubsubbing with.

Parameters:topic – topic to list connected peers of (string) Default: “”
Returns:A parsed dict result of:
{
    "Strings": [
        "<string>"
    ]
}
pubsub_pub(topic, data, **kwargs)[source]

Publish a message to a given pubsub topic.

Parameters:
  • topic – Topic to publish to. (string)
  • data – Payload of message to publish. (string)
Returns:

A aiohttp.ClientResponse object that can be read like a file.

pubsub_sub(topic, **kwargs)[source]

Subscribe to messages on a given topic.

Parameters:
  • topic – String name of topic to subscribe to. (string)
  • discover – try to discover other peers subscribed to the same topic. (bool) Default: False
Returns:

A parsed dict result of:

{
    "Message": {
        "From": [
            "<uint8>"
        ]
        "Data": [
            "<uint8>"
        ]
        "Seqno": [
            "<uint8>"
        ]
        "TopicIDs": [
            "<string>"
        ]
        "XXX_unrecognized": [
            "<uint8>"
        ]
    }
}

refs_local(**kwargs)[source]

List all local references.

Returns:A parsed dict result of:
{
    "Ref": "<string>"
    "Err": "<string>"
}
repo_fsck(**kwargs)[source]

Remove repo lockfiles.

Returns:A parsed dict result of:
{
    "Message": "<string>"
}
repo_gc(**kwargs)[source]

Perform a garbage collection sweep on the repo.

Parameters:
  • stream_errors – Stream errors. (bool) Default: False
  • quiet – Write minimal output. (bool) Default: False
Returns:

A parsed dict result of:

{
    "Key": "<string>"
    "Error": "<string>"
}

repo_stat(**kwargs)[source]

Get stats for the currently used repo.

Parameters:human – Output RepoSize in MiB. (bool) Default: False
Returns:A parsed dict result of:
{
    "NumObjects": "<uint64>"
    "RepoSize": "<uint64>"
    "RepoPath": "<string>"
    "Version": "<string>"
    "StorageMax": "<uint64>"
}
repo_verify(**kwargs)[source]

Verify all blocks in repo are not corrupted.

Returns:A parsed dict result of:
{
    "Msg": "<string>"
    "Progress": "<int>"
}
repo_version(**kwargs)[source]

Show the repo version.

Parameters:quiet – Write minimal output. (bool) Default: False
Returns:A parsed dict result of:
{
    "Version": "<string>"
}
resolve(name, **kwargs)[source]

Resolve the value of names to IPFS.

Parameters:
  • name – The name to resolve. (string)
  • recursive – Resolve until the result is an IPFS name. (bool) Default: False
  • dht_record_count – Number of records to request for DHT resolution. (uint) Default: 0
  • dht_timeout – Max time to collect values during DHT resolution eg “30s”. Pass 0 for no timeout. (string) Default: “”
Returns:

A parsed dict result of:

{
    "Path": "<string>"
}

shutdown(**kwargs)[source]

Shut down the ipfs daemon

Returns:A aiohttp.ClientResponse object that can be read like a file.
stats_bitswap(**kwargs)[source]

Show some diagnostic information on the bitswap agent.

Returns:A parsed dict result of:
{
    "ProvideBufLen": "<int>"
    "Wantlist": [
        "<string>"
    ]
    "Peers": [
        "<string>"
    ]
    "BlocksReceived": "<uint64>"
    "DataReceived": "<uint64>"
    "BlocksSent": "<uint64>"
    "DataSent": "<uint64>"
    "DupBlksReceived": "<uint64>"
    "DupDataReceived": "<uint64>"
}
stats_bw(**kwargs)[source]

Print ipfs bandwidth information.

Parameters:
  • peer – Specify a peer to print bandwidth for. (string) Default: “”
  • proto – Specify a protocol to print bandwidth for. (string) Default: “”
  • poll – Print bandwidth at an interval. (bool) Default: False
  • interval – Time interval to wait between updating output, if ‘poll’ is true. This accepts durations such as “300s”, “1.5h” or “2h45m”. Valid time units are: “ns”, “us” (or “µs”), “ms”, “s”, “m”, “h”. (string) Default: 1s
Returns:

A parsed dict result of:

{
    "TotalIn": "<int64>"
    "TotalOut": "<int64>"
    "RateIn": "<float64>"
    "RateOut": "<float64>"
}

stats_repo(**kwargs)[source]

Get stats for the currently used repo.

Parameters:human – Output RepoSize in MiB. (bool) Default: False
Returns:A parsed dict result of:
{
    "NumObjects": "<uint64>"
    "RepoSize": "<uint64>"
    "RepoPath": "<string>"
    "Version": "<string>"
    "StorageMax": "<uint64>"
}
swarm_addrs_listen(**kwargs)[source]

List interface listening addresses.

Returns:A parsed dict result of:
{
    "Strings": [
        "<string>"
    ]
}
swarm_addrs_local(**kwargs)[source]

List local addresses.

Parameters:id – Show peer ID in addresses. (bool) Default: False
Returns:A parsed dict result of:
{
    "Strings": [
        "<string>"
    ]
}
swarm_connect(address, **kwargs)[source]

Open connection to a given address.

Parameters:address – Address of peer to connect to. (string)
Returns:A parsed dict result of:
{
    "Strings": [
        "<string>"
    ]
}
swarm_disconnect(address, **kwargs)[source]

Close connection to a given address.

Parameters:address – Address of peer to disconnect from. (string)
Returns:A parsed dict result of:
{
    "Strings": [
        "<string>"
    ]
}
swarm_filters_add(address, **kwargs)[source]

Add an address filter.

Parameters:address – Multiaddr to filter. (string)
Returns:A parsed dict result of:
{
    "Strings": [
        "<string>"
    ]
}
swarm_filters_rm(address, **kwargs)[source]

Remove an address filter.

Parameters:address – Multiaddr filter to remove. (string)
Returns:A parsed dict result of:
{
    "Strings": [
        "<string>"
    ]
}
swarm_peers(**kwargs)[source]

List peers with open connections.

Parameters:
  • verbose – display all extra information. (bool) Default: False
  • streams – Also list information about open streams for each peer. (bool) Default: False
  • latency – Also list information about latency to each peer. (bool) Default: False
Returns:

A parsed dict result of:

{
    "Peers": [
        {
            "Addr": "<string>"
            "Peer": "<string>"
            "Latency": "<string>"
            "Muxer": "<string>"
            "Streams": [
                {
                    "Protocol": "<string>"
                }
            ]
        }
    ]
}

tar_add(file, **kwargs)[source]

Import a tar file into ipfs.

Parameters:file – Tar file to add. (string)
Returns:A parsed dict result of:
{
    "Name": "<string>"
    "Hash": "<string>"
    "Bytes": "<int64>"
    "Size": "<string>"
}
tar_cat(path, **kwargs)[source]

Export a tar file from IPFS.

Parameters:path – ipfs path of archive to export. (string)
Returns:A aiohttp.ClientResponse object that can be read like a file.
update(**kwargs)[source]
Parameters:args – Arguments for subcommand. (string) Default: “”
Returns:A aiohttp.ClientResponse object that can be read like a file.
version(**kwargs)[source]

Show ipfs version information.

Parameters:
  • number – Only show the version number. (bool) Default: False
  • commit – Show the commit hash. (bool) Default: False
  • repo – Show repo version. (bool) Default: False
  • all – Show all version information. (bool) Default: False
Returns:

A parsed dict result of:

{
    "Version": "<string>"
    "Commit": "<string>"
    "Repo": "<string>"
    "System": "<string>"
    "Golang": "<string>"
}