Skip to main content

A Flask extension that provides UUID converters for different UUID versions.

Project description

Select your language: English, Español

RouteUUID

RouteUUID is a Flask extension that allows you to differentiate between various UUID versions in your routes.

Features

  • UUID Version Differentiation
    Use specific URL converters to ensure that the UUID in the route matches the expected version.
UUID Version Converter Provider Observation
UUID <uuid:...> werkzeug Native; does not distinguish version
UUID v1 <uuid1:...> routeuuid
UUID v2 <uuid2:...> Not Implemented
UUID v3 <uuid3:...> routeuuid
UUID v4 <uuid4:...> routeuuid
UUID v5 <uuid5:...> routeuuid

Installation

You can install RouteUUID via pip:

pip install routeuuid

Below is a simple example of how to use RouteUUID in your Flask application:

from uuid import UUID
from flask import Flask
from routeuuid import RouteUUID

app = Flask(__name__)

# Register the custom UUID converters in the Flask app.
RouteUUID(app)

# Or:
#
# route_uuid = RouteUUID()
# ...
# route_uuid.init_app(app)

@app.route("/item/<uuid4:item_id>")
def get_item_v4(item_id: UUID):
    return f"Item ID (UUID v4): {item_id}"

@app.route("/item/<uuid1:item_id")
def get_item_v1(item_id: UUID):
    return f"Item ID (UUID v1): {item_id}"

if __name__ == "__main__":
    app.run(debug=True)

In this example, the route /item/<uuid4:item_id> will only accept strings that conform to the format of a UUID version 4.

License

This project is distributed under the MIT License. See the LICENSE file for more details.

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

routeuuid-0.1.0.tar.gz (3.9 kB view details)

Uploaded Source

Built Distribution

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

routeuuid-0.1.0-py3-none-any.whl (4.5 kB view details)

Uploaded Python 3

File details

Details for the file routeuuid-0.1.0.tar.gz.

File metadata

  • Download URL: routeuuid-0.1.0.tar.gz
  • Upload date:
  • Size: 3.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.5

File hashes

Hashes for routeuuid-0.1.0.tar.gz
Algorithm Hash digest
SHA256 2d875795e8aa201dfef15d82984bf5dc87ee99928292ba7a5446185b2a633767
MD5 70b3da476bea23955b7471c1caa0757d
BLAKE2b-256 85dec2b372669576c43c7754c6e2c80ee1ddebd5c52c722f0a4dc402413b628a

See more details on using hashes here.

File details

Details for the file routeuuid-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: routeuuid-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 4.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.5

File hashes

Hashes for routeuuid-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ac381da86572f5a5568dd38aac3342d552fc7a6504cee4347223cd586e802cf3
MD5 bfab4982a800d939fb45750adf0825e5
BLAKE2b-256 24f341c2543148da6b1ad034a299967395d9a635221290f3a83f9637465fd359

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