converted from flask-restful to flask
parent
f5fb8b6dfe
commit
16b2cffc21
|
@ -1,9 +1,8 @@
|
||||||
"""Entry point for the API that supports the Mycroft Marketplace."""
|
"""Entry point for the API that supports the Mycroft Marketplace."""
|
||||||
from flask import Flask
|
from flask import Flask
|
||||||
from flask_restful import Api
|
|
||||||
|
|
||||||
from selene.api import AccountEndpoint, AgreementsEndpoint, get_base_config
|
from selene.api import get_base_config, selene_api, SeleneResponse
|
||||||
from selene.api import JSON_MIMETYPE, output_json
|
from selene.api.endpoints import AccountEndpoint, AgreementsEndpoint
|
||||||
from selene.util.log import configure_logger
|
from selene.util.log import configure_logger
|
||||||
|
|
||||||
_log = configure_logger('account_api')
|
_log = configure_logger('account_api')
|
||||||
|
@ -11,9 +10,16 @@ _log = configure_logger('account_api')
|
||||||
# Define the Flask application
|
# Define the Flask application
|
||||||
acct = Flask(__name__)
|
acct = Flask(__name__)
|
||||||
acct.config.from_object(get_base_config())
|
acct.config.from_object(get_base_config())
|
||||||
|
acct.response_class = SeleneResponse
|
||||||
|
acct.register_blueprint(selene_api)
|
||||||
|
|
||||||
# Define the API and its endpoints.
|
acct.add_url_rule(
|
||||||
acct_api = Api(acct)
|
'/api/account',
|
||||||
acct_api.representations[JSON_MIMETYPE] = output_json
|
view_func=AccountEndpoint.as_view('account_api'),
|
||||||
acct_api.add_resource(AccountEndpoint, '/api/account')
|
methods=['GET', 'POST']
|
||||||
acct_api.add_resource(AgreementsEndpoint, '/api/agreement/<agreement_type>')
|
)
|
||||||
|
acct.add_url_rule(
|
||||||
|
'/api/agreement/<string:agreement_type>',
|
||||||
|
view_func=AgreementsEndpoint.as_view('agreements_api'),
|
||||||
|
methods=['GET']
|
||||||
|
)
|
||||||
|
|
Loading…
Reference in New Issue