Source code for fegistry.views

# Copyright ⓒ 2016 Red Hat, Inc.
# This file is part of fegistry.
#
# fegistry is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# fegistry is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Foobar.  If not, see <http://www.gnu.org/licenses/>.
import flask


app = flask.Flask(__name__)


@app.after_request
[docs]def add_docker_headers(response): """ Add the necessary Docker headers to every response. Args: response (flask.Response): The :class:`flask.Response` to modify Returns: flask.Response: The modified flask response """ response.headers['Docker-Distribution-API-Version'] = 'registry/2.0' return response
@app.route('/v2/')
[docs]def v2(): """ Answer the GET /v2/ API call with {}. Returns: flask.Response: A JSON response """ return flask.json.jsonify({})