Skip to main content

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

tag_uri-0.1.1.tar.gz (6.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

tag_uri-0.1.1-py3-none-any.whl (6.7 kB view details)

Uploaded Python 3

File details

Details for the file tag_uri-0.1.1.tar.gz.

File metadata

  • Download URL: tag_uri-0.1.1.tar.gz
  • Upload date:
  • Size: 6.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.2 CPython/3.11.8 Linux/6.6.19-1-MANJARO

File hashes

Hashes for tag_uri-0.1.1.tar.gz
Algorithm Hash digest
SHA256 53c83e2b671257c75783d9b072200ca47297d9ac138f2a73680d5e3ecb78acf4
MD5 1f7426b77120151e1402db5c69c1a3aa
BLAKE2b-256 e77b989e4300c2c3207f81aed356cf20fe7b6d047310d81550681486535909b3

See more details on using hashes here.

File details

Details for the file tag_uri-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: tag_uri-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 6.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.2 CPython/3.11.8 Linux/6.6.19-1-MANJARO

File hashes

Hashes for tag_uri-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 2cf0cf4ee728e700f7b6609876234c5e4204cd1bb27d71049111f3413baa8e82
MD5 6f60fa462918a9c589671a73c5591002
BLAKE2b-256 1c3068daa845107d22266cefddd6db5dddb06f7ed2ee428dcc4b45e74cfeb178

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page