From 22dd019ab4fcc972952f6ede656919af8ce3e451 Mon Sep 17 00:00:00 2001 From: opelly27 <35671196+opelly27@users.noreply.github.com> Date: Fri, 17 Sep 2021 10:07:06 -0700 Subject: [PATCH] initial commit --- HelloWorldAPI.py | 16 ++++++++++++++++ apicaller.py | 8 ++++++++ 2 files changed, 24 insertions(+) create mode 100644 HelloWorldAPI.py create mode 100644 apicaller.py diff --git a/HelloWorldAPI.py b/HelloWorldAPI.py new file mode 100644 index 0000000..64bf303 --- /dev/null +++ b/HelloWorldAPI.py @@ -0,0 +1,16 @@ +from flask import Flask +from flask_restful import Api, Resource + +app = Flask(__name__) +api = Api(app) + +class HelloWorld(Resource): + + def get(self): + return {"data": "hello world"} + +api.add_resource(HelloWorld, "/helloworld") + + +if __name__ == "__main__": + app.run(debug=True) \ No newline at end of file diff --git a/apicaller.py b/apicaller.py new file mode 100644 index 0000000..377e75b --- /dev/null +++ b/apicaller.py @@ -0,0 +1,8 @@ +import requests + + +base = "http://127.0.0.1:5000/" + +r = requests.get(base + "helloworld") + +print(r.json()) \ No newline at end of file