Below is the code I'm using for Simple REST API. It is working fine. The REST URL is like http://127.0.0.1:8080/sample/100 But I need to pass 100 as a key value pair like http://127.0.0.1:8080/sample?runtime=100. Is this possible or any other python library that will help
app = Flask(__name__)
api = Api(app)
class Analysis(Resource):
def get(self, runtime):
result2 = result1.to_json(orient='records')
return json.loads(result2)
api.add_resource(Analysis, '/sample/<runtime>')
if __name__ == '__main__':
app.run(port='8080')
Check out "The Request Object" section of the Flask Quickstart documentation here: http://flask.pocoo.org/docs/0.12/quickstart/
make sure you include this in your imports: