Advertisement
Guest User

Untitled

a guest
Jun 24th, 2019
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.60 KB | None | 0 0
  1. #! /usr/bin/env python
  2. # coding: utf-8
  3.  
  4. from flask import Flask, Response
  5. from flask_restful import Resource, Api
  6. import json
  7.  
  8. app = Flask(__name__)
  9. # Create the API
  10. API = Api(app)
  11.  
  12.  
  13.  
  14. @app.route('/')
  15. def hello_world():
  16. return Response('Here, with Response it works well: höne')
  17.  
  18. class APICLASS(Resource):
  19. """
  20.  
  21. """
  22. def get(self, id):
  23. return [
  24. {
  25. "hey": 11,
  26. "test": "höne"
  27. }]
  28.  
  29.  
  30. API .add_resource(APICLASS, '/<string:id>')
  31.  
  32. if __name__ == '__main__':
  33. app.run(debug=True)
  34.  
  35. [
  36. {
  37. "hey": 11,
  38. "test": "hu00f6ne"
  39. }]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement