cavisson-pythonagent 0.0.1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- cavisson_pythonagent-0.0.1.dist-info/METADATA +32 -0
- cavisson_pythonagent-0.0.1.dist-info/RECORD +180 -0
- cavisson_pythonagent-0.0.1.dist-info/WHEEL +5 -0
- cavisson_pythonagent-0.0.1.dist-info/licenses/LICENSE +19 -0
- cavisson_pythonagent-0.0.1.dist-info/top_level.txt +1 -0
- pythonagent/__init__.py +22 -0
- pythonagent/agent/__init__.py +219 -0
- pythonagent/agent/internal/__init__.py +1 -0
- pythonagent/agent/internal/agent.py +1651 -0
- pythonagent/agent/internal/framesinfo.py +152 -0
- pythonagent/agent/internal/heap_dump.py +39 -0
- pythonagent/agent/internal/intercept_module.py +70 -0
- pythonagent/agent/internal/logs.py +122 -0
- pythonagent/agent/internal/metadata/__init__.py +0 -0
- pythonagent/agent/internal/metadata/agent_meta_data.py +276 -0
- pythonagent/agent/internal/proc_compat.py +75 -0
- pythonagent/agent/internal/profile.py +47 -0
- pythonagent/agent/internal/provider.py +83 -0
- pythonagent/agent/internal/thread_dump.py +85 -0
- pythonagent/agent/internal/udp.py +245 -0
- pythonagent/agent/internal/udp_message.py +800 -0
- pythonagent/agent/probes/Instrumentation/__init__.py +340 -0
- pythonagent/agent/probes/Instrumentation/find.py +243 -0
- pythonagent/agent/probes/Instrumentation/module_version_resolver.py +155 -0
- pythonagent/agent/probes/Instrumentation/new_parser.py +64 -0
- pythonagent/agent/probes/Instrumentation/parser.py +129 -0
- pythonagent/agent/probes/__init__.py +219 -0
- pythonagent/agent/probes/base.py +303 -0
- pythonagent/agent/probes/cache/__init__.py +51 -0
- pythonagent/agent/probes/cache/redis.py +119 -0
- pythonagent/agent/probes/cache/redis_asyncio.py +83 -0
- pythonagent/agent/probes/coroutines/__init__.py +1 -0
- pythonagent/agent/probes/coroutines/asyncio.py +63 -0
- pythonagent/agent/probes/elasticdb/__init__.py +7 -0
- pythonagent/agent/probes/elasticdb/aelastic.py +54 -0
- pythonagent/agent/probes/frameworks/__init__.py +27 -0
- pythonagent/agent/probes/frameworks/agentprofiler.py +105 -0
- pythonagent/agent/probes/frameworks/aiohttp_web.py +155 -0
- pythonagent/agent/probes/frameworks/aisess.py +151 -0
- pythonagent/agent/probes/frameworks/asgi.py +340 -0
- pythonagent/agent/probes/frameworks/bottle.py +27 -0
- pythonagent/agent/probes/frameworks/cherry.py +25 -0
- pythonagent/agent/probes/frameworks/django.py +128 -0
- pythonagent/agent/probes/frameworks/falcon.py +21 -0
- pythonagent/agent/probes/frameworks/fastapi.py +35 -0
- pythonagent/agent/probes/frameworks/flask.py +30 -0
- pythonagent/agent/probes/frameworks/pyramid.py +56 -0
- pythonagent/agent/probes/frameworks/test.py +108 -0
- pythonagent/agent/probes/frameworks/tornado_async_web.py +117 -0
- pythonagent/agent/probes/frameworks/tornado_web.py +133 -0
- pythonagent/agent/probes/frameworks/wsgi.py +353 -0
- pythonagent/agent/probes/grpc/__init__.py +76 -0
- pythonagent/agent/probes/grpc/client_interceptor.py +132 -0
- pythonagent/agent/probes/grpc/server_interceptor.py +129 -0
- pythonagent/agent/probes/havoc/__init__.py +0 -0
- pythonagent/agent/probes/havoc/custom_memory_stress.py +186 -0
- pythonagent/agent/probes/havoc/custom_thread_stress.py +187 -0
- pythonagent/agent/probes/havoc/havoc_constants.py +218 -0
- pythonagent/agent/probes/havoc/havoc_manager.py +981 -0
- pythonagent/agent/probes/http/__init__.py +49 -0
- pythonagent/agent/probes/http/aiohttp_client.py +59 -0
- pythonagent/agent/probes/http/boto.py +12 -0
- pythonagent/agent/probes/http/httplib.py +110 -0
- pythonagent/agent/probes/http/httpx_client.py +116 -0
- pythonagent/agent/probes/http/requests.py +15 -0
- pythonagent/agent/probes/http/tornado_httpclient.py +85 -0
- pythonagent/agent/probes/http/urllib3.py +16 -0
- pythonagent/agent/probes/langchain/__init__.py +21 -0
- pythonagent/agent/probes/langchain/base_tool.py +95 -0
- pythonagent/agent/probes/langchain/langchain_community.py +136 -0
- pythonagent/agent/probes/langchain/langchain_core.py +32 -0
- pythonagent/agent/probes/langchain/langchain_openai.py +110 -0
- pythonagent/agent/probes/logging/__init__.py +106 -0
- pythonagent/agent/probes/message_brokers/__init__.py +4 -0
- pythonagent/agent/probes/message_brokers/pika.py +126 -0
- pythonagent/agent/probes/mongodb/__init__.py +6 -0
- pythonagent/agent/probes/mongodb/pymongo.py +286 -0
- pythonagent/agent/probes/openai/__init__.py +3 -0
- pythonagent/agent/probes/openai/openai.py +797 -0
- pythonagent/agent/probes/span.py +101 -0
- pythonagent/agent/probes/sql/__init__.py +13 -0
- pythonagent/agent/probes/sql/botocores3.py +51 -0
- pythonagent/agent/probes/sql/dbapi.py +285 -0
- pythonagent/agent/probes/sql/dynamodb.py +90 -0
- pythonagent/agent/probes/sql/mysql_connector.py +24 -0
- pythonagent/agent/probes/sql/mysql_connector_cext.py +24 -0
- pythonagent/agent/probes/sql/mysqldb.py +43 -0
- pythonagent/agent/probes/sql/psycopg2.py +174 -0
- pythonagent/agent/probes/sql/pymysql.py +25 -0
- pythonagent/bootstrap/__init__.py +0 -0
- pythonagent/bootstrap/cav_gunicorn.py +26 -0
- pythonagent/bootstrap/cavagent_lambda_wrapper.py +291 -0
- pythonagent/bootstrap/run.py +47 -0
- pythonagent/bootstrap/sitecustomize.py +287 -0
- pythonagent/cavisson/netdiagnostics/CavAgent/instrumentationprofile.json +26 -0
- pythonagent/cavisson/netdiagnostics/CavAgent/interceptor_points.txt +29 -0
- pythonagent/cavisson/netdiagnostics/python/CavAgent/instrumentationprofile.json +42 -0
- pythonagent/cavisson/netdiagnostics/python/CavAgent/interceptor_points.txt +29 -0
- pythonagent/cavisson/netdiagnostics/python/config/ndsettings.conf +6 -0
- pythonagent/config.py +279 -0
- pythonagent/find.py +72 -0
- pythonagent/find_mod_cls_name.py +54 -0
- pythonagent/lang.py +131 -0
- pythonagent/lib.py +91 -0
- pythonagent/main/__init__.py +0 -0
- pythonagent/main/pytrace/__init__.py +79 -0
- pythonagent/main/pytrace/commands/__init__.py +0 -0
- pythonagent/main/pytrace/commands/auto_discovery.py +25 -0
- pythonagent/main/pytrace/commands/run.py +401 -0
- pythonagent/main/pytrace/pytrace.py +133 -0
- pythonagent/main/wsgi.py +6 -0
- pythonagent/main.py +27 -0
- pythonagent/run.py +46 -0
- pythonagent/sqins.py +8 -0
- pythonagent/test.py +73 -0
- pythonagent/utils.py +168 -0
- pythonagent/vendor/__init__.py +0 -0
- pythonagent/vendor/pympler/__init__.py +1 -0
- pythonagent/vendor/pympler/asizeof.py +2810 -0
- pythonagent/vendor/pympler/charts.py +62 -0
- pythonagent/vendor/pympler/classtracker.py +590 -0
- pythonagent/vendor/pympler/classtracker_stats.py +780 -0
- pythonagent/vendor/pympler/garbagegraph.py +80 -0
- pythonagent/vendor/pympler/mprofile.py +97 -0
- pythonagent/vendor/pympler/muppy.py +275 -0
- pythonagent/vendor/pympler/panels.py +115 -0
- pythonagent/vendor/pympler/process.py +238 -0
- pythonagent/vendor/pympler/py.typed +0 -0
- pythonagent/vendor/pympler/refbrowser.py +451 -0
- pythonagent/vendor/pympler/refgraph.py +350 -0
- pythonagent/vendor/pympler/summary.py +321 -0
- pythonagent/vendor/pympler/tracker.py +267 -0
- pythonagent/vendor/pympler/util/__init__.py +0 -0
- pythonagent/vendor/pympler/util/bottle.py +3809 -0
- pythonagent/vendor/pympler/util/compat.py +23 -0
- pythonagent/vendor/pympler/util/stringutils.py +77 -0
- pythonagent/vendor/pympler/web.py +346 -0
- pythonagent/vendor/werkzeug/__init__.py +20 -0
- pythonagent/vendor/werkzeug/_compat.py +228 -0
- pythonagent/vendor/werkzeug/_internal.py +473 -0
- pythonagent/vendor/werkzeug/_reloader.py +341 -0
- pythonagent/vendor/werkzeug/datastructures.py +3120 -0
- pythonagent/vendor/werkzeug/debug/__init__.py +498 -0
- pythonagent/vendor/werkzeug/debug/console.py +218 -0
- pythonagent/vendor/werkzeug/debug/repr.py +297 -0
- pythonagent/vendor/werkzeug/debug/tbtools.py +628 -0
- pythonagent/vendor/werkzeug/exceptions.py +829 -0
- pythonagent/vendor/werkzeug/filesystem.py +64 -0
- pythonagent/vendor/werkzeug/formparser.py +584 -0
- pythonagent/vendor/werkzeug/http.py +1307 -0
- pythonagent/vendor/werkzeug/local.py +420 -0
- pythonagent/vendor/werkzeug/middleware/__init__.py +25 -0
- pythonagent/vendor/werkzeug/middleware/dispatcher.py +66 -0
- pythonagent/vendor/werkzeug/middleware/http_proxy.py +219 -0
- pythonagent/vendor/werkzeug/middleware/lint.py +408 -0
- pythonagent/vendor/werkzeug/middleware/profiler.py +132 -0
- pythonagent/vendor/werkzeug/middleware/proxy_fix.py +169 -0
- pythonagent/vendor/werkzeug/middleware/shared_data.py +293 -0
- pythonagent/vendor/werkzeug/posixemulation.py +117 -0
- pythonagent/vendor/werkzeug/routing.py +2210 -0
- pythonagent/vendor/werkzeug/security.py +249 -0
- pythonagent/vendor/werkzeug/serving.py +1117 -0
- pythonagent/vendor/werkzeug/test.py +1123 -0
- pythonagent/vendor/werkzeug/testapp.py +241 -0
- pythonagent/vendor/werkzeug/urls.py +1138 -0
- pythonagent/vendor/werkzeug/useragents.py +202 -0
- pythonagent/vendor/werkzeug/utils.py +778 -0
- pythonagent/vendor/werkzeug/wrappers/__init__.py +36 -0
- pythonagent/vendor/werkzeug/wrappers/accept.py +50 -0
- pythonagent/vendor/werkzeug/wrappers/auth.py +33 -0
- pythonagent/vendor/werkzeug/wrappers/base_request.py +673 -0
- pythonagent/vendor/werkzeug/wrappers/base_response.py +700 -0
- pythonagent/vendor/werkzeug/wrappers/common_descriptors.py +341 -0
- pythonagent/vendor/werkzeug/wrappers/cors.py +100 -0
- pythonagent/vendor/werkzeug/wrappers/etag.py +304 -0
- pythonagent/vendor/werkzeug/wrappers/json.py +145 -0
- pythonagent/vendor/werkzeug/wrappers/request.py +49 -0
- pythonagent/vendor/werkzeug/wrappers/response.py +84 -0
- pythonagent/vendor/werkzeug/wrappers/user_agent.py +14 -0
- pythonagent/vendor/werkzeug/wsgi.py +1000 -0
|
@@ -0,0 +1,241 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
"""
|
|
3
|
+
werkzeug.testapp
|
|
4
|
+
~~~~~~~~~~~~~~~~
|
|
5
|
+
|
|
6
|
+
Provide a small test application that can be used to test a WSGI server
|
|
7
|
+
and check it for WSGI compliance.
|
|
8
|
+
|
|
9
|
+
:copyright: 2007 Pallets
|
|
10
|
+
:license: BSD-3-Clause
|
|
11
|
+
"""
|
|
12
|
+
import base64
|
|
13
|
+
import os
|
|
14
|
+
import sys
|
|
15
|
+
from textwrap import wrap
|
|
16
|
+
|
|
17
|
+
from . import __version__ as _werkzeug_version
|
|
18
|
+
from .utils import escape
|
|
19
|
+
from .wrappers import BaseRequest as Request
|
|
20
|
+
from .wrappers import BaseResponse as Response
|
|
21
|
+
|
|
22
|
+
logo = Response(
|
|
23
|
+
base64.b64decode(
|
|
24
|
+
"""
|
|
25
|
+
R0lGODlhoACgAOMIAAEDACwpAEpCAGdgAJaKAM28AOnVAP3rAP/////////
|
|
26
|
+
//////////////////////yH5BAEKAAgALAAAAACgAKAAAAT+EMlJq704680R+F0ojmRpnuj0rWnrv
|
|
27
|
+
nB8rbRs33gu0bzu/0AObxgsGn3D5HHJbCUFyqZ0ukkSDlAidctNFg7gbI9LZlrBaHGtzAae0eloe25
|
|
28
|
+
7w9EDOX2fst/xenyCIn5/gFqDiVVDV4aGeYiKkhSFjnCQY5OTlZaXgZp8nJ2ekaB0SQOjqphrpnOiq
|
|
29
|
+
ncEn65UsLGytLVmQ6m4sQazpbtLqL/HwpnER8bHyLrLOc3Oz8PRONPU1crXN9na263dMt/g4SzjMeX
|
|
30
|
+
m5yDpLqgG7OzJ4u8lT/P69ej3JPn69kHzN2OIAHkB9RUYSFCFQYQJFTIkCDBiwoXWGnowaLEjRm7+G
|
|
31
|
+
p9A7H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IErrKri85keKqRQYX9VX0/eAUK1hrSu6HMEX3Qh2sCh0q0D2CtnUqS4hj62sE/z
|
|
56
|
+
aDs2Sg7MBS6xnQeooc2R2tC9YrKpEi9pLXfYXp20tDCpSP8rKlrD4axprb9u1Df5hSbz9QU0cRpfgn
|
|
57
|
+
kiIzwKucd0wsEHlLpe5yHXuc6FrNelOl7pY2+11kTWx7VpRu97dXA3DO1vbkhcb4zyvERYajQgAADs
|
|
58
|
+
="""
|
|
59
|
+
),
|
|
60
|
+
mimetype="image/png",
|
|
61
|
+
)
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
TEMPLATE = u"""\
|
|
65
|
+
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
|
|
66
|
+
"http://www.w3.org/TR/html4/loose.dtd">
|
|
67
|
+
<title>WSGI Information</title>
|
|
68
|
+
<style type="text/css">
|
|
69
|
+
@import url(https://fonts.googleapis.com/css?family=Ubuntu);
|
|
70
|
+
|
|
71
|
+
body { font-family: 'Lucida Grande', 'Lucida Sans Unicode', 'Geneva',
|
|
72
|
+
'Verdana', sans-serif; background-color: white; color: #000;
|
|
73
|
+
font-size: 15px; text-align: center; }
|
|
74
|
+
#logo { float: right; padding: 0 0 10px 10px; }
|
|
75
|
+
div.box { text-align: left; width: 45em; margin: auto; padding: 50px 0;
|
|
76
|
+
background-color: white; }
|
|
77
|
+
h1, h2 { font-family: 'Ubuntu', 'Lucida Grande', 'Lucida Sans Unicode',
|
|
78
|
+
'Geneva', 'Verdana', sans-serif; font-weight: normal; }
|
|
79
|
+
h1 { margin: 0 0 30px 0; }
|
|
80
|
+
h2 { font-size: 1.4em; margin: 1em 0 0.5em 0; }
|
|
81
|
+
table { width: 100%%; border-collapse: collapse; border: 1px solid #AFC5C9 }
|
|
82
|
+
table th { background-color: #AFC1C4; color: white; font-size: 0.72em;
|
|
83
|
+
font-weight: normal; width: 18em; vertical-align: top;
|
|
84
|
+
padding: 0.5em 0 0.1em 0.5em; }
|
|
85
|
+
table td { border: 1px solid #AFC5C9; padding: 0.1em 0 0.1em 0.5em; }
|
|
86
|
+
code { font-family: 'Consolas', 'Monaco', 'Bitstream Vera Sans Mono',
|
|
87
|
+
monospace; font-size: 0.7em; }
|
|
88
|
+
ul li { line-height: 1.5em; }
|
|
89
|
+
ul.path { font-size: 0.7em; margin: 0 -30px; padding: 8px 30px;
|
|
90
|
+
list-style: none; background: #E8EFF0; }
|
|
91
|
+
ul.path li { line-height: 1.6em; }
|
|
92
|
+
li.virtual { color: #999; text-decoration: underline; }
|
|
93
|
+
li.exp { background: white; }
|
|
94
|
+
</style>
|
|
95
|
+
<div class="box">
|
|
96
|
+
<img src="?resource=logo" id="logo" alt="[The Werkzeug Logo]" />
|
|
97
|
+
<h1>WSGI Information</h1>
|
|
98
|
+
<p>
|
|
99
|
+
This page displays all available information about the WSGI server and
|
|
100
|
+
the underlying Python interpreter.
|
|
101
|
+
<h2 id="python-interpreter">Python Interpreter</h2>
|
|
102
|
+
<table>
|
|
103
|
+
<tr>
|
|
104
|
+
<th>Python Version
|
|
105
|
+
<td>%(python_version)s
|
|
106
|
+
<tr>
|
|
107
|
+
<th>Platform
|
|
108
|
+
<td>%(platform)s [%(os)s]
|
|
109
|
+
<tr>
|
|
110
|
+
<th>API Version
|
|
111
|
+
<td>%(api_version)s
|
|
112
|
+
<tr>
|
|
113
|
+
<th>Byteorder
|
|
114
|
+
<td>%(byteorder)s
|
|
115
|
+
<tr>
|
|
116
|
+
<th>Werkzeug Version
|
|
117
|
+
<td>%(werkzeug_version)s
|
|
118
|
+
</table>
|
|
119
|
+
<h2 id="wsgi-environment">WSGI Environment</h2>
|
|
120
|
+
<table>%(wsgi_env)s</table>
|
|
121
|
+
<h2 id="installed-eggs">Installed Eggs</h2>
|
|
122
|
+
<p>
|
|
123
|
+
The following python packages were installed on the system as
|
|
124
|
+
Python eggs:
|
|
125
|
+
<ul>%(python_eggs)s</ul>
|
|
126
|
+
<h2 id="sys-path">System Path</h2>
|
|
127
|
+
<p>
|
|
128
|
+
The following paths are the current contents of the load path. The
|
|
129
|
+
following entries are looked up for Python packages. Note that not
|
|
130
|
+
all items in this path are folders. Gray and underlined items are
|
|
131
|
+
entries pointing to invalid resources or used by custom import hooks
|
|
132
|
+
such as the zip importer.
|
|
133
|
+
<p>
|
|
134
|
+
Items with a bright background were expanded for display from a relative
|
|
135
|
+
path. If you encounter such paths in the output you might want to check
|
|
136
|
+
your setup as relative paths are usually problematic in multithreaded
|
|
137
|
+
environments.
|
|
138
|
+
<ul class="path">%(sys_path)s</ul>
|
|
139
|
+
</div>
|
|
140
|
+
"""
|
|
141
|
+
|
|
142
|
+
|
|
143
|
+
def iter_sys_path():
|
|
144
|
+
if os.name == "posix":
|
|
145
|
+
|
|
146
|
+
def strip(x):
|
|
147
|
+
prefix = os.path.expanduser("~")
|
|
148
|
+
if x.startswith(prefix):
|
|
149
|
+
x = "~" + x[len(prefix) :]
|
|
150
|
+
return x
|
|
151
|
+
|
|
152
|
+
else:
|
|
153
|
+
|
|
154
|
+
def strip(x):
|
|
155
|
+
return x
|
|
156
|
+
|
|
157
|
+
cwd = os.path.abspath(os.getcwd())
|
|
158
|
+
for item in sys.path:
|
|
159
|
+
path = os.path.join(cwd, item or os.path.curdir)
|
|
160
|
+
yield strip(os.path.normpath(path)), not os.path.isdir(path), path != item
|
|
161
|
+
|
|
162
|
+
|
|
163
|
+
def render_testapp(req):
|
|
164
|
+
try:
|
|
165
|
+
import pkg_resources
|
|
166
|
+
except ImportError:
|
|
167
|
+
eggs = ()
|
|
168
|
+
else:
|
|
169
|
+
eggs = sorted(pkg_resources.working_set, key=lambda x: x.project_name.lower())
|
|
170
|
+
python_eggs = []
|
|
171
|
+
for egg in eggs:
|
|
172
|
+
try:
|
|
173
|
+
version = egg.version
|
|
174
|
+
except (ValueError, AttributeError):
|
|
175
|
+
version = "unknown"
|
|
176
|
+
python_eggs.append(
|
|
177
|
+
"<li>%s <small>[%s]</small>" % (escape(egg.project_name), escape(version))
|
|
178
|
+
)
|
|
179
|
+
|
|
180
|
+
wsgi_env = []
|
|
181
|
+
sorted_environ = sorted(req.environ.items(), key=lambda x: repr(x[0]).lower())
|
|
182
|
+
for key, value in sorted_environ:
|
|
183
|
+
wsgi_env.append(
|
|
184
|
+
"<tr><th>%s<td><code>%s</code>"
|
|
185
|
+
% (escape(str(key)), " ".join(wrap(escape(repr(value)))))
|
|
186
|
+
)
|
|
187
|
+
|
|
188
|
+
sys_path = []
|
|
189
|
+
for item, virtual, expanded in iter_sys_path():
|
|
190
|
+
class_ = []
|
|
191
|
+
if virtual:
|
|
192
|
+
class_.append("virtual")
|
|
193
|
+
if expanded:
|
|
194
|
+
class_.append("exp")
|
|
195
|
+
sys_path.append(
|
|
196
|
+
"<li%s>%s"
|
|
197
|
+
% (' class="%s"' % " ".join(class_) if class_ else "", escape(item))
|
|
198
|
+
)
|
|
199
|
+
|
|
200
|
+
return (
|
|
201
|
+
TEMPLATE
|
|
202
|
+
% {
|
|
203
|
+
"python_version": "<br>".join(escape(sys.version).splitlines()),
|
|
204
|
+
"platform": escape(sys.platform),
|
|
205
|
+
"os": escape(os.name),
|
|
206
|
+
"api_version": sys.api_version,
|
|
207
|
+
"byteorder": sys.byteorder,
|
|
208
|
+
"werkzeug_version": _werkzeug_version,
|
|
209
|
+
"python_eggs": "\n".join(python_eggs),
|
|
210
|
+
"wsgi_env": "\n".join(wsgi_env),
|
|
211
|
+
"sys_path": "\n".join(sys_path),
|
|
212
|
+
}
|
|
213
|
+
).encode("utf-8")
|
|
214
|
+
|
|
215
|
+
|
|
216
|
+
def test_app(environ, start_response):
|
|
217
|
+
"""Simple test application that dumps the environment. You can use
|
|
218
|
+
it to check if Werkzeug is working properly:
|
|
219
|
+
|
|
220
|
+
.. sourcecode:: pycon
|
|
221
|
+
|
|
222
|
+
>>> from werkzeug.serving import run_simple
|
|
223
|
+
>>> from werkzeug.testapp import test_app
|
|
224
|
+
>>> run_simple('localhost', 3000, test_app)
|
|
225
|
+
* Running on http://localhost:3000/
|
|
226
|
+
|
|
227
|
+
The application displays important information from the WSGI environment,
|
|
228
|
+
the Python interpreter and the installed libraries.
|
|
229
|
+
"""
|
|
230
|
+
req = Request(environ, populate_request=False)
|
|
231
|
+
if req.args.get("resource") == "logo":
|
|
232
|
+
response = logo
|
|
233
|
+
else:
|
|
234
|
+
response = Response(render_testapp(req), mimetype="text/html")
|
|
235
|
+
return response(environ, start_response)
|
|
236
|
+
|
|
237
|
+
|
|
238
|
+
if __name__ == "__main__":
|
|
239
|
+
from .serving import run_simple
|
|
240
|
+
|
|
241
|
+
run_simple("localhost", 5000, test_app, use_reloader=True)
|