Dell FORCE10 Open Automation Manual de usuario Pagina 71

  • Descarga
  • Añadir a mis manuales
  • Imprimir
  • Pagina
    / 98
  • Tabla de contenidos
  • MARCADORES
  • Valorado. / 5. Basado en revisión del cliente
Vista de pagina 70
Programmatic Management | 71
The following example shows how to embed an HTTP get request in Python script.
Figure 7-2. Python Sample with HTTP Get Request that Invokes the REST API
#!/usr/bin/python
import httplib
conn = httplib.HTTPConnection("10.42.51.5")
# Send HTTP GET request
conn.request("GET","/cgi-bin/F10Ping?IpAddress=10.42.0.13")
# Get response data
response = conn.getresponse()
# Display response texts on success or display status
if(response.status == 200):
# Handle response data
data = response.read()
print data
else :
# Handle error
print "Operation failed",response.status,response.reason
conn.close()
Vista de pagina 70
1 2 ... 66 67 68 69 70 71 72 73 74 75 76 ... 97 98

Comentarios a estos manuales

Sin comentarios