Skip to main content

A simple router / treelib for python.

Project description

SimpleRoute

A simple router / treelib for python.

Usage

Installation

pip install simpleroute

Import

Note: as simpleroute uses two dictionaries internally rather than an OOP-based node system,

Traverse replaces the standard "Node" class present in most other tree libraries.

from simpleroute import BaseRouter, Router, Traverse

Classes

router = BaseRouter([]) # list of paths sep by /
path, kwargs = router.match("SOME_STR_HERE") #match wildcards, eg /etc/1 to /etc/:num
router = Router({}) # dict of paths:datavals sep by /
path, kwargs, data = router.match("SOME_STR_HERE") #match wildcards, eg /etc/1 to /etc/:num
traverse = Traverse.go(router, path="SOME_PATH_HERE") #returns an object of Traverse, optional path to go
#use get_child, get_children, get_parent, get_data, get_path, get_sub to manipulate the object

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

simpleroute-0.0.3.tar.gz (8.6 kB view details)

Uploaded Source

Built Distribution

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

simpleroute-0.0.3-py3-none-any.whl (8.8 kB view details)

Uploaded Python 3

File details

Details for the file simpleroute-0.0.3.tar.gz.

File metadata

  • Download URL: simpleroute-0.0.3.tar.gz
  • Upload date:
  • Size: 8.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.3

File hashes

Hashes for simpleroute-0.0.3.tar.gz
Algorithm Hash digest
SHA256 6b6d25248d06663b896f2547729674cb8887f65957cc8e09e9e333710398946b
MD5 f2d92f69a0c48cc51c2a6baa6bd83a37
BLAKE2b-256 edf8359c2e2538276ac64420515fd3451eee2d9660f076b4002aac1994b3fbfd

See more details on using hashes here.

File details

Details for the file simpleroute-0.0.3-py3-none-any.whl.

File metadata

  • Download URL: simpleroute-0.0.3-py3-none-any.whl
  • Upload date:
  • Size: 8.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.3

File hashes

Hashes for simpleroute-0.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 0dacfdc30188d74375afdd1fa41ee1dd338eb165fc840102dc85b141aad32120
MD5 2b5f908f1db83e4d265852081752dd54
BLAKE2b-256 c88742cdd45492425287b63579c96b5b53812928aa792e262180f34cac513e25

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