4. WARC Record blocks

You use any of these classes as a content block for a basc_warc.Record object.

4.1. Bytes

This is the standard type of block, and lets you expose a series of bytes (a file, HTTP request, etc) as a block for a basc_warc.Record.

class basc_warc.RecordBlock(content=None)

Block for an arbitrary record.

Parameters:content (bytes) – Block of content to expose in this record.

4.2. warcinfo Block

This type of block is used for warcinfo Records, and lets you easily set keys and values.

class basc_warc.WarcinfoBlock(fields={})

Block for a warcinfo record.

Parameters:fields (dict) – Fields to create this block with.
WarcinfoBlock.set_field(name, value)

Set field to given value.

Parameters:
  • name (string) – Name of the field.
  • value (string or int) – Value of the field.