Skip to content

Commit 792e7cb

Browse files
committed
Update for HTTPS and fix a few typos.
This was tested on a 3850 running 16.5(1).
1 parent b913487 commit 792e7cb

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

RC-get-config/RC-get-config.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@
2828
# prints it out in a "pretty" XML tree.
2929

3030
from argparse import ArgumentParser
31-
from ncclient import manager
3231
import requests
3332

3433
if __name__ == '__main__':
@@ -42,7 +41,7 @@
4241
help="User credentials for the request")
4342
parser.add_argument('-passwd', '--password', type=str, default='cisco',
4443
help="It's the password")
45-
parser.add_argument('-port', '--port', type=int, default=830,
44+
parser.add_argument('-port', '--port', type=int, default=443,
4645
help="Specify this if you want a non-default port")
4746

4847
args = parser.parse_args()
@@ -52,12 +51,12 @@
5251
host = args.host
5352
port = str(args.port)
5453

55-
url = "http://" + host + ":" + port + "/restconf/api/running/"
54+
url = "https://" + host + ":" + port + "/restconf/api/running/"
5655

5756
headers = {
5857
"Content-Type": "application/vnd.yang.datastore+json",
5958
"Accept": "application/vnd.yang.datastore+json",
6059
}
61-
response = requests.request("GET", url, headers=headers, auth=(username,password))
60+
response = requests.request("GET", url, headers=headers, auth=(username,password), verify=False)
6261

63-
print(response.text)
62+
print(response.text)

0 commit comments

Comments
 (0)