RFC 4151 Tag URI taguri.org parser and generator
Project description
Parser and Generator For Tag URIs
Tag URIs are a format of URI with the schema tag:
and are used for globally namespaced identifiers. These can be more useful than for example naked UUIDs because they have namespacing based on domain names and dates as well as can have URL-like paths and fragments.
See taguri.org for details and RFC 4151.
Usage
Installation pip install tag_uri
, and add pip install tag_uri[cli]
to include dependencies needed for the tag-uri
command.
Example
from datetime import date
from tag_uri import TagURI
parsed = TagURI.parse("tag:example.com,2018-01:example/112233")
assert str(parsed) == "tag:example.com,2018-01:example/112233"
maker = TagURI.maker("josh@example.com")
made = maker("example/5432", "test")
assert str(made) == "tag:josh@example.com,2024-01-19:example/5432#test"
assert made.tagging_entity.authority_name == "josh@example.com"
assert made.tagging_entity.date == date(2024, 1, 19)
Command line use
With pyyaml
installed, you can parse any number of tag URIs by passing them
either as command line arguments or as lines via stdin. The parsed results will be output to stdout as YAML.
tag-uri tag:example.com,2018-01-02:example/223344
echo tag:example.com,2019-02-03:example/334455 | tag-uri
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.