-
Notifications
You must be signed in to change notification settings - Fork 122
/
main_template.py
42 lines (36 loc) · 1.15 KB
/
main_template.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
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 jsonify({"text": text.upper()})
api.add_resource(UppercaseText, "/uppercase")
if __name__ == "__main__":
app.run(debug=True)