arcp (Archive and Package) URI parser and generator

0.2.1 · active · verified Thu Apr 16

arcp is a Python library (current version 0.2.1) designed for creating and parsing arcp (Archive and Package) URIs. These URIs are used to identify or refer to hypermedia files bundled within an archive or application package, such as a ZIP file. The library focuses solely on URI generation and parsing and does not provide functionality for interacting with archive files (like `zipfile`) or making network requests (`urllib.request`). Its release cadence appears slow, with the last update to PyPI in February 2020.

Common errors

Warnings

Install

Imports

Quickstart

This quickstart demonstrates how to create an arcp URI using `arcp.serialize()` and parse an existing arcp URI string into its components using `arcp.parse()`.

import arcp

# Example 1: Creating an arcp URI
uri_str = arcp.serialize(authority='uuid', name='32a423d6-52ab-47e3-a9cd-54f418a48571', path='/doc.html')
print(f"Generated URI: {uri_str}")
# Expected: arcp://uuid,32a423d6-52ab-47e3-a9cd-54f418a48571/doc.html

# Example 2: Parsing an arcp URI
parsed_uri = arcp.parse("arcp://ni,sha-256;F-34D4TUeOfG0selz7REKRDo4XePkewPeQYtjL3vQs0/metadata.json")
print(f"Parsed URI scheme: {parsed_uri.scheme}")
print(f"Parsed URI authority: {parsed_uri.authority}")
print(f"Parsed URI path: {parsed_uri.path}")
print(f"Parsed URI name: {parsed_uri.name}")
print(f"Parsed URI identifier: {parsed_uri.identifier}")

view raw JSON →