From 0ad35b9b50dfaa1083f3f5acc633ec769bc10e37 Mon Sep 17 00:00:00 2001 From: Andrew Guschin Date: Sun, 18 Apr 2021 16:25:48 +0400 Subject: Initial commit --- req.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 req.py (limited to 'req.py') 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()) + -- cgit v1.2.3