-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathrequests_test.rn
53 lines (42 loc) · 1.54 KB
/
requests_test.rn
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
# API testing
var request = Requests()
var json = Json()
# get request to the API
# var response_get = request.get("https://jsonplaceholder.typicode.com/posts")
# print(response_get)
# print(type(response_get))
# print(response_get.status_code)
# var radon_object = json.loads(response_get)
# print(type(radon_object))
# print(arr_len(radon_object))
# for post in radon_object {
# print(post["title"])
# }
# post request to the API
# var response_post = request.post("https://jsonplaceholder.typicode.com/posts", {"title": "foo", "body": "bar", "userId": 1})
# print(response_post)
# print(type(response_post))
# var radon_object = json.loads(response_post)
# print(radon_object)
# print(type(radon_object))
# put request to the API
# var response_put = request.put("https://jsonplaceholder.typicode.com/posts/1", {"id": 1, "title": "foo", "body": "bar", "userId": 1})
# print(response_put)
# print(type(response_put))
# var radon_object = json.loads(response_put)
# print(radon_object)
# print(type(radon_object))
# delete request to the API
# var response_delete = request.delete("https://jsonplaceholder.typicode.com/posts/1")
# print(response_delete)
# print(type(response_delete))
# var radon_object = json.loads(response_delete)
# print(radon_object)
# print(type(radon_object))
# patch request to the API
# var response_patch = request.patch("https://jsonplaceholder.typicode.com/posts/1", {"title": "foo"})
# print(response_patch)
# print(type(response_patch))
# var radon_object = json.loads(response_patch)
# print(radon_object)
# print(type(radon_object))