Skip to content

Catblob

snoop.data.management.commands.catblob #

Dump an object from object storage to standard output.

The object (Blob) is fetched by its SHA3-256 primary key.

Can be used by third parties to export data; is not used internally.

Classes#

Command #

Write blobs to stdout.

Methods#
add_arguments(self, parser) #

Entry point for subclassed commands to add custom arguments.

Source code in snoop/data/management/commands/catblob.py
def add_arguments(self, parser):
    parser.add_argument('blob_id', type=str, help="SHA3-256 based blob ID.")
handle(self, *args, **options) #

The actual logic of the command. Subclasses must implement this method.

Source code in snoop/data/management/commands/catblob.py
def handle(self, *args, **options):
    logging_for_management_command()

    if options['blob_id']:
        with models.Blob.objects.get(pk=options['blob_id']).open() as f:
            sys.stdout.buffer.write(f.read())
            sys.stdout.flush()