Dell FORCE10 Open Automation Instrukcja Użytkownika Strona 71

  • Pobierz
  • Dodaj do moich podręczników
  • Drukuj
  • Strona
    / 98
  • Spis treści
  • BOOKMARKI
  • Oceniono. / 5. Na podstawie oceny klientów
Przeglądanie stron 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()
Przeglądanie stron 70
1 2 ... 66 67 68 69 70 71 72 73 74 75 76 ... 97 98

Komentarze do niniejszej Instrukcji

Brak uwag