From 769718aeb292ba2210d4f9b2d6465b3384fe1350 Mon Sep 17 00:00:00 2001 From: Timothy Crosley Date: Wed, 24 Jan 2018 11:51:36 -0800 Subject: [PATCH] Add sink example --- examples/sink_example.py | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 examples/sink_example.py diff --git a/examples/sink_example.py b/examples/sink_example.py new file mode 100644 index 00000000..454e0e39 --- /dev/null +++ b/examples/sink_example.py @@ -0,0 +1,10 @@ +"""This is an example of a hug "sink", these enable all request URLs that start with the one defined to be captured + +To try this out, run this api with hug sink_example.py and hit any URL after localhost:8000/all/ (for example: localhost:8000/all/the/things/ +""" +import hug + + +@hug.sink('/all') +def my_sink(request): + return request.path.replace('/all', '')