summaryrefslogtreecommitdiff
path: root/req.py
diff options
context:
space:
mode:
authorAndrew Guschin <saintruler@gmail.com>2021-04-18 16:25:48 +0400
committerAndrew Guschin <saintruler@gmail.com>2021-04-18 16:25:48 +0400
commit0ad35b9b50dfaa1083f3f5acc633ec769bc10e37 (patch)
tree4acfde7b0b09fb258002055a8d0e2d5e1a9c5c3e /req.py
Initial commit
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())
+