Merged in master (pull request #24)
fix(init): add importlib context to connexion init
This commit is contained in:
commit
390791bb81
2 changed files with 10 additions and 7 deletions
|
|
@ -1,6 +1,6 @@
|
||||||
[metadata]
|
[metadata]
|
||||||
name = httpaste-victorykit
|
name = httpaste-victorykit
|
||||||
version = 1.0.6-alpha
|
version = 1.0.7-alpha
|
||||||
author = Tiara Rodney
|
author = Tiara Rodney
|
||||||
author_email = t.rodney@victoryk.it
|
author_email = t.rodney@victoryk.it
|
||||||
description = a versatile HTTP pastebin
|
description = a versatile HTTP pastebin
|
||||||
|
|
|
||||||
|
|
@ -144,6 +144,7 @@ from configparser import ConfigParser
|
||||||
from ast import literal_eval
|
from ast import literal_eval
|
||||||
from io import StringIO
|
from io import StringIO
|
||||||
from os import environ
|
from os import environ
|
||||||
|
from importlib.resources import path as pkg_resource_path
|
||||||
|
|
||||||
from connexion import FlaskApp
|
from connexion import FlaskApp
|
||||||
from connexion.resolver import RestyResolver
|
from connexion.resolver import RestyResolver
|
||||||
|
|
@ -301,13 +302,15 @@ def get_flask_app(
|
||||||
|
|
||||||
options = {"swagger_ui": server_config.swagger_ui}
|
options = {"swagger_ui": server_config.swagger_ui}
|
||||||
|
|
||||||
application = FlaskApp(__name__, specification_dir='schema/')
|
#context manager returns a pathlib.Path object
|
||||||
|
with pkg_resource_path('httpaste.schema', 'httpaste.openapi.json') as path:
|
||||||
|
application = FlaskApp(__name__, specification_dir=path.parent)
|
||||||
|
|
||||||
application.add_api(
|
application.add_api(
|
||||||
'httpaste.openapi.json',
|
path.name,
|
||||||
options=options,
|
options=options,
|
||||||
resolver=RestyResolver('httpaste.controller')
|
resolver=RestyResolver('httpaste.controller')
|
||||||
)
|
)
|
||||||
|
|
||||||
for err_cls in [
|
for err_cls in [
|
||||||
BadRequestError,
|
BadRequestError,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue