-
Notifications
You must be signed in to change notification settings - Fork 97
/
test.pyhtml
executable file
·133 lines (92 loc) · 3.27 KB
/
test.pyhtml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>MicroWebSrv2 - PyhtmlTemplate Module</title>
<link rel="stylesheet" href="style.css" />
</head>
<body>
{{ py }}
import sys
global Toto
try :
Toto += 1
except :
Toto = 1
{{ end }}
<h1>MicroWebSrv2 - PyhtmlTemplate Module</h1>
<div class="sep"></div>
Platform: {{ sys.platform }} <br />
Version: {{ sys.version }} <br />
<div class="sep"></div>
Global var "TestVar" : <span class="label">{{ TestVar }}</span><br />
* Set from the main program.
<div class="sep"></div>
Global var "Toto" : <span class="label">{{ Toto }}</span><br />
* Refresh this page to see this variable changing.
<div class="sep"></div>
{{ py }}
print('Unescaped HTML: <strong><u>Okay</u></strong>')
{{ end }}
<div class="sep"></div>
Your address:<br />
<ul>
<li> IP = {{ Request.UserAddress[0] }} </li>
<li> Port = {{ Request.UserAddress[1] }} </li>
</ul>
<div class="sep"></div>
{{ if 'CHROME' in Request.UserAgent.upper() }}
You are on <span class="label">Chrome</span> browser.
{{ elif 'FIREFOX' in Request.UserAgent.upper() }}
You are on <span class="label">Firefox</span> browser.
{{ else }}
You are not on Chrome or Firefox browser.
{{ end }}
<div class="sep"></div>
You are in SSL: {{ Request.IsSSL }}<br />
<div class="sep"></div>
Your host: {{ Request.Host }}<br />
<div class="sep"></div>
Requested path: {{ Request.Path }}<br />
<div class="sep"></div>
Your query params:
{{ if not Request.QueryParams }}
<a href="?question=How are you?&answer=I'm fine!">
Test query string on this page.
</a>
{{ else }}
<ul>
{{ for param in Request.QueryParams }}
<li>Param "{{ param }}" = "{{ Request.QueryParams[param] }}"</li>
{{ end }}
</ul>
{{ end }}
<div class="sep"></div>
Accepted content types:
<ul>
{{ for accept in Request.Accept }}
<li>{{ accept }}</li>
{{ end }}
</ul>
<div class="sep"></div>
Accepted encodings:
<ul>
{{ for encoding in Request.AcceptEncodings }}
<li>{{ encoding }}</li>
{{ end }}
</ul>
<div class="sep"></div>
Accepted languages:
<ul>
{{ for language in Request.AcceptLanguages }}
<li>{{ language }}</li>
{{ end }}
</ul>
<div class="sep"></div>
Your request is keep-alive: {{ Request.IsKeepAlive }}<br />
<div class="sep"></div>
Your user agent:<br />
{{ Request.UserAgent }}
<div class="sep"></div>
</body>
</html>