We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 74f5c77 commit 653863dCopy full SHA for 653863d
1 file changed
python_functions.py
@@ -0,0 +1,22 @@
1
+import requests
2
+
3
+def test_api_get():
4
+ resp = requests.get("https://reqres.in/api/users?page=2")
5
+ assert (resp.status_code == 200), "Status code is not 200. Rather found : " + str(resp.status_code)
6
+ for record in resp.json()['data']:
7
+ if record['id'] == 7:
8
+ if record['first_name'] == "Michael":
9
+ print("Data matched!")
10
11
12
+def test_api_post():
13
+ data = {'name': 'PRIME',
14
+ 'job': 'DEVOPS'}
15
+ resp = requests.post(url="https://reqres.in/api/users", data=data)
16
+ data = resp.json()
17
+ print(data)
18
19
20
+test_api_get()
21
22
+test_api_post()
0 commit comments