直接上干货,后续完善……
代码
# !/usr/bin/env python
# -*- coding:utf-8 -*-
# Date: 2017/9/1
# Author: David Meng
# Script name: cisco.py + cisco.json
# Description: crawl CISCO health status
import urllib
import urllib2
import cookielib
import ssl
import xml.dom.minidom
import time
import os
import codecs
import json
def ciscocheck(ip, user, passwd):
address, username, password = ip, user, passwd
# This file will be created temporarily in related path '.', and will be removed.
xmlfile = "cisco" + time.strftime("%Y%m%d%H%M%S", time.localtime()) + ".xml"
deltempfile = "yes"
loginurl = "https://" + address +