from flask import Flask, jsonify, request from flask_restful import Api, Resource from flasgger import Swagger app = Flask(__name__) api = Api(app) swagger = Swagger(app) class UppercaseText(Resource): def get(self): """ This method responds to the GET request for this endpoint and returns the data in uppercase. --- tags: - Text Processing parameters: - name: text in: query type: string required: true description: The text to be converted to uppercase responses: 200: description: A successful GET request content: application/json: schema: type: object properties: text: type: string description: The text in uppercase """ text = request.args.get('text') return {"text": text.upper()}, 200 def get(self): """ This method responds to the GET request for this endpoint and returns the data in uppercase. --- tags: - Text Processing parameters: - name: Messages in: query type: string required: true description: The text to be converted to uppercase responses: 200: description: A successful GET request content: application/json: schema: type: object properties: text: type: string description: The text in uppercase """ text = request.args.get('text') return {"text": text.upper()}, 200 class StringGenerator(Resource): def get(self): """ This method responds to the GET request for this endpoint and returns the data in uppercase. --- tags: - Text Processing parameters: - name: Messages in: query type: string required: true description: The text to be converted to uppercase - name: Duplication in: query type: string required: true description: The text to be converted to uppercase - name: Capitalization in: query type: string required: true description: The text to be converted to uppercase responses: 200: description: A successful GET request content: application/json: schema: type: object properties: text: type: string description: The text in uppercase """ text = request.args.get('text') return {"text": text.upper()}, 200 api.add_resource(UppercaseText, "/uppercase") api.add_resource(StringGenerator, "/stringgenerator") if __name__ == "__main__": app.run(debug=True)