summaryrefslogtreecommitdiff
path: root/req.py
diff options
context:
space:
mode:
Diffstat (limited to 'req.py')
-rw-r--r--req.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/req.py b/req.py
new file mode 100644
index 0000000..d995123
--- /dev/null
+++ b/req.py
@@ -0,0 +1,14 @@
+import requests as req
+from pprint import pprint
+
+r = req.get("http://localhost:8080/api/posts")
+pprint(r.json())
+
+data = {"id": 7, "title": "Some article", "body": "hey", "published": True}
+r = req.post("http://localhost:8080/api/posts/add", json=data)
+pprint(r.json())
+
+data = {"id": 8, "title": "Some article", "body": "hey"}
+r = req.post("http://localhost:8080/api/posts/add", json=data)
+pprint(r.json())
+