Skip to content

Commit

Permalink
Move to flask-restx
Browse files Browse the repository at this point in the history
  • Loading branch information
iksaif committed Feb 19, 2020
1 parent 9d3a4a8 commit f6173bb
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions example/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@

# Optional API.
try:
import flask_restplus
import flask_restx
except ImportError:
flask_restplus = None
flask_restx = None


class Error(Exception):
Expand Down Expand Up @@ -59,19 +59,19 @@ def is_healthy():
return True


if flask_restplus:
if flask_restx:

class HelloWorld(flask_restplus.Resource):
class HelloWorld(flask_restx.Resource):
def get(self):
return {"hello": "world"}


def initialize_api(flask_app):
"""Initialize an API."""
if not flask_restplus:
if not flask_restx:
return

api = flask_restplus.Api(version="1.0", title="My Example API")
api = flask_restx.Api(version="1.0", title="My Example API")
api.add_resource(HelloWorld, "/hello")

blueprint = flask.Blueprint("api", __name__, url_prefix="/api")
Expand Down

0 comments on commit f6173bb

Please sign in to comment.