def screenshot(ip): import pycisco.cipimage as cipimage cip_data = cmpush.screenshot(ip, 'user', 'password') tree = fromstring(cip_data) im = cipimage.load_cip(tree) img_io = StringIO() im.save(img_io, 'GIF') img_io.seek(0) return send_file(img_io, mimetype='image/gif')
import plac import sys import pycisco.cipimage as cipimage import pycisco.cmpush as cmpush from xml.etree.ElementTree import ElementTree, fromstring ip = sys.argv[1] cip_data = cmpush.screenshot(ip, 'user', 'password') tree = fromstring(cip_data) im = cipimage.load_cip(tree) im.save(sys.stdout, format= 'JPEG') im.show()