Skip to content

Commit 085e8d6

Browse files
Add html serve example
1 parent beea8c3 commit 085e8d6

2 files changed

Lines changed: 25 additions & 0 deletions

File tree

examples/document.html

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<html>
2+
<body>
3+
<h1>
4+
Header
5+
</h1>
6+
<p>
7+
Contents
8+
</p>
9+
</body>
10+
</html>

examples/html_serve.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import os
2+
3+
import hug
4+
5+
6+
DIRECTORY = os.path.dirname(os.path.realpath(__file__))
7+
8+
9+
@hug.get('/get/document', output=hug.output_format.html)
10+
def nagiosCommandHelp(**kwargs):
11+
"""
12+
Returns command help document when no command is specified
13+
"""
14+
with open(os.path.join(DIRECTORY, 'document.html')) as document:
15+
return document.read()

0 commit comments

Comments
 (0)