|
@@ -2,37 +2,14 @@
|
2
|
2
|
import json
|
3
|
3
|
from http import HTTPStatus
|
4
|
4
|
|
5
|
|
-#import bottle
|
6
|
5
|
from pyramid.config import Configurator
|
7
|
6
|
from wsgiref.simple_server import make_server
|
8
|
|
-import time
|
9
|
|
-import yaml
|
10
|
|
-import uuid
|
11
|
|
-from beaker.middleware import SessionMiddleware
|
12
|
7
|
|
13
|
8
|
import hapic
|
14
|
9
|
from example import HelloResponseSchema, HelloPathSchema, HelloJsonSchema, \
|
15
|
10
|
ErrorResponseSchema, HelloQuerySchema
|
16
|
11
|
from hapic.data import HapicData
|
17
|
|
-
|
18
|
|
-# hapic.global_exception_handler(UnAuthExc, StandardErrorSchema)
|
19
|
|
-# hapic.global_exception_handler(UnAuthExc2, StandardErrorSchema)
|
20
|
|
-# hapic.global_exception_handler(UnAuthExc3, StandardErrorSchema)
|
21
|
|
-# bottle.default_app.push(app)
|
22
|
|
-
|
23
|
|
-# session_opts = {
|
24
|
|
-# 'session.type': 'file',
|
25
|
|
-# 'session.data_dir': '/tmp',
|
26
|
|
-# 'session.cookie_expires': 3600,
|
27
|
|
-# 'session.auto': True
|
28
|
|
-# }
|
29
|
|
-# session_middleware = SessionMiddleware(
|
30
|
|
-# app,
|
31
|
|
-# session_opts,
|
32
|
|
-# environ_key='beaker.session',
|
33
|
|
-# key='beaker.session.id',
|
34
|
|
-# )
|
35
|
|
-# app = session_middleware.wrap_app
|
|
12
|
+from hapic.ext.pyramid import PyramidContext
|
36
|
13
|
|
37
|
14
|
|
38
|
15
|
def bob(f):
|
|
@@ -118,7 +95,7 @@ controllers = Controllers()
|
118
|
95
|
|
119
|
96
|
controllers.bind(configurator)
|
120
|
97
|
|
121
|
|
-hapic.set_context(hapic.ext.pyramid.PyramidContext(configurator))
|
|
98
|
+hapic.set_context(PyramidContext(configurator))
|
122
|
99
|
print(json.dumps(hapic.generate_doc()))
|
123
|
100
|
|
124
|
101
|
server = make_server('0.0.0.0', 8080, configurator.make_wsgi_app())
|