File tree Expand file tree Collapse file tree 4 files changed +11
-9
lines changed Expand file tree Collapse file tree 4 files changed +11
-9
lines changed Original file line number Diff line number Diff line change 21
21
# management server.
22
22
from cpapi import APIClient , APIClientArgs
23
23
24
- # new hostname value to be defined
25
- HOSTNAME = "my-new-hostname"
26
-
27
24
28
25
def main ():
29
26
# getting details from the user
@@ -35,6 +32,8 @@ def main():
35
32
print ("Attention! Your password will be shown on the screen!" )
36
33
password = raw_input ("Enter password: " )
37
34
35
+ hostname = raw_input ("hostname value to be defined:" )
36
+
38
37
client_args = APIClientArgs (server = api_server ,
39
38
api_version = "1" ,
40
39
unsafe = True ,
@@ -57,7 +56,7 @@ def main():
57
56
print ("Failed to get hostname '{}'" .format (api_res .data ))
58
57
59
58
# request to set hostname
60
- api_res = client .api_call ("set-hostname" , {"name" : HOSTNAME })
59
+ api_res = client .api_call ("set-hostname" , {"name" : hostname })
61
60
if api_res .success :
62
61
print ("Hostname name changed to '{}'" .format (api_res .data ["name" ]))
63
62
else :
Original file line number Diff line number Diff line change @@ -51,7 +51,8 @@ def main():
51
51
if api_res .success :
52
52
# in order to access any field within the data that had
53
53
# returned, simple use api_res.data["field name"] or refer to
54
- # the documentation page - https://<your-server-ip>/gaia_docs/
54
+ # the documentation page -
55
+ # https://sc1.checkpoint.com/documents/latest/GaiaAPIs/
55
56
print (
56
57
"Physical interface name is '{}' , ipv4 address is '{}', "
57
58
"interface mtu is '{}' " .format (api_res .data ["name" ],
Original file line number Diff line number Diff line change 21
21
# management server.
22
22
from cpapi import APIClient , APIClientArgs
23
23
24
- HOSTNAME = "my-new-hostname"
25
-
26
24
27
25
def main ():
28
26
# getting details from the user
@@ -34,6 +32,8 @@ def main():
34
32
print ("Attention! Your password will be shown on the screen!" )
35
33
password = input ("Enter password: " )
36
34
35
+ hostname = input ("hostname value to be defined:" )
36
+
37
37
client_args = APIClientArgs (server = api_server , api_version = "1" ,
38
38
unsafe = True , context = "gaia_api" )
39
39
@@ -54,7 +54,7 @@ def main():
54
54
print ("Failed to get hostname '{}'" .format (api_res .data ))
55
55
56
56
# request to set hostname
57
- api_res = client .api_call ("set-hostname" , {"name" : HOSTNAME })
57
+ api_res = client .api_call ("set-hostname" , {"name" : hostname })
58
58
if api_res .success :
59
59
print ("Hostname name changed to '{}'" .format (api_res .data ["name" ]))
60
60
else :
Original file line number Diff line number Diff line change @@ -50,7 +50,9 @@ def main():
50
50
})
51
51
if api_res .success :
52
52
# in order to access any field within the data that had
53
- # returned, simple use api_res.data["field name"]
53
+ # returned, simple use api_res.data["field name"] or refer to
54
+ # the documentation page -
55
+ # https://sc1.checkpoint.com/documents/latest/GaiaAPIs/
54
56
print (
55
57
"Physical interface name is '{}' , ipv4 address is '{}', "
56
58
"interface mtu is '{}' " .format (api_res .data ["name" ],
You can’t perform that action at this time.
0 commit comments