skip to Main Content

I have a python script in Apache server, and inside this script there are many types of data.
I want to request those data using REST API.
How can I do it ?

2

Answers


  1. I suggest you to try to use Flask:

    from flask import Flask from flask_restful import Resource, Api
    
    app = Flask(__name__) api = Api(app)
    
    class HelloWorld(Resource):
        def get(self):
            return {'hello': 'world'}
    
    api.add_resource(HelloWorld, '/')
    
    if __name__ == '__main__':
        app.run(debug=True)
    
    Login or Signup to reply.
  2. You can use Flask! Here’s some documentation: http://flask.pocoo.org/docs/1.0/quickstart/#routing

    Basically, you can define your routes through Flask so you can return specific data for specific endpoints that you create.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search