Digi ConnectPort Network Device Podręcznik Użytkownika Strona 91

  • Pobierz
  • Dodaj do moich podręczników
  • Drukuj
  • Strona
    / 95
  • Spis treści
  • BOOKMARKI
  • Oceniono. / 5. Na podstawie oceny klientów
Przeglądanie stron 90
Sample programs
91
RCI callback
An RCI callback involves two types of actions, demonstrated in the following programs:
Making RCI requests from Python applications
Extending RCI to allow iDigi to make requests of Python applications. This is known as
an RCI callback.
Make an RCI request-example program
import rci (1)
request_string=""" (2)
<rci_request version="1.1">
<query_state>
<interface_info name="eth0">
<ip/>
</interface_info>
</query_state>
</rci_request>
"""
print rci.process_request(request_string) (3)
Program notes
1 The rci module includes the process_request function needed by the program.
2 A string representing the RCI request is needed. The sample uses the Python multi-line
string syntax to make it clearer that the XML represents a request for the current IP address
of the Ethernet interface. Combining the lines into a single string on one line would work in
the same way.
3 The RCI XML is submitted for parsing, and the resulting string is returned. In this sample,
the result is simply printed.
Przeglądanie stron 90
1 2 ... 86 87 88 89 90 91 92 93 94 95

Komentarze do niniejszej Instrukcji

Brak uwag