@@ -29,11 +29,11 @@ def get_node(url, nodeid):
29
29
click .secho (pprint .pprint (response .text ), fg = "green" )
30
30
31
31
32
- def get_nodes (url ):
32
+ def get_nodes (url , limit , offset ):
33
33
headers = {
34
34
"Content-Type" : "application/json; charset=utf-8" ,
35
35
}
36
- url = url + "/nodes"
36
+ url = url + "/nodes?limit=" + str ( limit ) + "&offset=" + str ( offset )
37
37
click .secho (url )
38
38
response = requests .get (url , headers = headers )
39
39
click .secho (response .status_code , fg = "green" )
@@ -51,18 +51,31 @@ def get_nodes(url):
51
51
)
52
52
@click .option (
53
53
"--nodes" ,
54
+ is_flag = True ,
54
55
required = False ,
55
56
help = "Get last nodes results" ,
56
57
)
58
+ @click .option (
59
+ "--limit" ,
60
+ default = 50 ,
61
+ required = False ,
62
+ help = "Pagination limit for nodes" ,
63
+ )
64
+ @click .option (
65
+ "--offset" ,
66
+ default = 0 ,
67
+ required = False ,
68
+ help = "Offset of the pagination" ,
69
+ )
57
70
@click .pass_context
58
- def results (ctx , nodeid , nodes ):
71
+ def results (ctx , nodeid , nodes , limit , offset ):
59
72
config = ctx .obj .get ("CFG" )
60
73
instance = ctx .obj .get ("INSTANCE" )
61
74
url = api_connection (config [instance ]["host" ])
62
75
if nodeid :
63
76
get_node (url , nodeid )
64
77
if nodes :
65
- get_nodes (url )
78
+ get_nodes (url , limit , offset )
66
79
67
80
68
81
if __name__ == "__main__" :
0 commit comments