Basic Host Info Example

This sample invokes and displays information about a specific website by invoking the URLVoid API service via DXL.

For more information see:



To run this sample execute the sample/basic/ script as follows:

python sample/basic/

The output should appear similar to the following:

Response for URLVoid host info:
<?xml version="1.0" encoding="UTF-8"?><response>
            <asname>Team Internet AG</asname>

The received results are displayed.


The majority of the sample code is shown below:

# Create the client
with DxlClient(config) as client:

    # Connect to the fabric
    client.connect()"Connected to DXL fabric.")

    # Invoke 'host info' method
    request_topic = "/opendxl-urlvoid/service/urlvapi/host/info"

    req = Request(request_topic)
    MessageUtils.dict_to_json_payload(req, {"host": ""})

    res = client.sync_request(req, timeout=60)
    if res.message_type != Message.MESSAGE_TYPE_ERROR:
        payload = MessageUtils.decode_payload(res)
        xml = xml.dom.minidom.parseString(payload)
        print("Response for URLVoid host info:")
            indent='    ', newl='', encoding="UTF-8").decode("UTF-8"))
        print("Error invoking service with topic '{0}': {1} ({2})".format(
            request_topic, res.error_message, res.error_code))

After connecting to the DXL fabric, a request message is created with a topic that targets the "host info" method of the URLVoid API DXL service.

The next step is to set the payload of the request message. The contents of the payload include the host to report on.

The final step is to perform a synchronous request via the DXL fabric. If the response message is not an error its contents are formatted and displayed.