思科DevNet-學(xué)習(xí)筆記-癸酉

20161230 1922
今天看到的,網(wǎng)上的教學(xué)資料
https://launchschool.com/books

LaunchSchool


A Simple Web Server Greg Wilson -- 介紹如何用Python庫編寫一個簡單的Web服務(wù)器。

實驗樓-網(wǎng)上做實驗

https://www.shiyanlou.com/courses/running

This is a collection of sample scripts and tools for APIC-EM.-思科DevNet 使用Python庫調(diào)用APIC-EM API, 實現(xiàn)網(wǎng)絡(luò)設(shè)備自動化配置。(SDN)
我特別喜歡的一段代碼
Python Sample Notification Listener

import socket
import sys

# this listens to notification stream from MSE and displays results in console.

# Create a TCP/IP socket
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)

# Bind the socket to the address given on the command line
server_address = ('0.0.0.0', 8000)                                # change this to your ip address
sock.bind(server_address)
# print >>sys.stderr, 'using %s port %s' % sock.getsockname()     # use this print statement for python2.7
print (sys.stderr,'using %s port %s' % sock.getsockname())        # use this print statement for python3
sock.listen(1)

while True:
   print (sys.stderr, 'waiting for a connection')                 # use this print statement for python3
   # print >>sys.stderr, 'waiting for a connection'               # use this print statement for python2.7
   connection, client_address = sock.accept()
   try:
       #print >>sys.stderr, 'client connected:', client_address   # use this print statement for python2.7
       print (sys.stderr, 'client connected:', client_address)    # use this print statement for python3
       while True:
           data = connection.recv(1024)                           # change this value, based on your needs.
           print (sys.stderr, 'received "%s"' % data)             # use this print statement for python3
           #print >>sys.stderr, 'received "%s"' % data            # use this print statement for python2.7
           if data:
               connection.sendall(data)
           else:
               break
   finally:
       connection.close()

我特別喜歡的一段代碼
Python Sample Notification Listener -
URL:https://msesandbox.cisco.com:8081/apidocs/code

最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時請結(jié)合常識與多方信息審慎甄別。
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點,簡書系信息發(fā)布平臺,僅提供信息存儲服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容