DVEO REST API wrapper for Python

This module tries to make using the DVEO REST API easier to use with Python.

Example of usage:

>>> from dveo import API
>>> dveo = API('203.0.113.12', 'p455w0rd')
>>> dveo.system_status()['system']['uptime']
OrderedDict([('days', '20'), ('hours', '7'), ('mins', '51')])
>>> dveo.list_inputs()
['net_stream1', 'net_stream2', 'net_stream3', 'net_stream4', ...]
>>> dveo.input_config('net_stream2')['inputname']
'BigTV'
>>> dveo.input_by_output_param('rtmptargeturi', 'acme', partial=True, include_value=True)
[('net_stream1', 'rtmp://vid1.acme.net/stream'), ('net_stream2', 'rtmp://stream10.acme.com/rtmp'), ('net_stream3', 'rtmp://stream11.acme.com/rtmp'), ...]

Check out the variables and commands of your DVEO device API on http(s)://YOURDVEODEVICE:25599/metadata. The URL isn’t protected. The port is set in the DVEO configuration.

Installation

$ pipenv install dveo

Example scripts

In the examples directory you’ll find some implementation examples.

  • retrieve_stream_settings.py loads input and output settings for one or more encoders and prints them and writes them to a json file.

Documentation

Find autogenerated documentation at:

https://dveo.readthedocs.io/

Tested platforms

This code has been tested against the following devices:

  • MultiStreamer DIG/IP
  • Brutus II
  • Brutus III

If you have tested this on another device, please let me know.

How to enable API

To enable the REST API on your DVEO device, follow these steps:

  1. Log in to web interface.

  2. Click on the SYSTEM SETUP tab.

  3. Open the Web Server Setup menu on the left.

  4. Select the API Web Server submenu.

  5. Check the Enable API Web Server box.

  6. If you choose to set Enable User Security to Yes:

    Fill in a password at API User Password (apiuser).

  7. Click the Update button.

  8. Restart the service in the Service Control menu to the right. If it’s stopped it’ll be started.

Package contents

dveo package

Module contents

class dveo.API(address, password, username='apiuser', port='25599', https=False, data_format='json')[source]

Bases: object

Instantiate a single DVEO API container object.

Parameters:
  • address (str) – IP address or hostname of encoder.
  • password (str) – Password for the apiuser account, if user security is disabled anything is valid, like ‘’.
  • username (str) – (optional) apiuser username is usually locked to apiuser.
  • port (str or int) – (optional) Port number configured for the API webserver, defaults to 25599.
  • https (bool) – (optional) Enable https instead of http connections, defaults to False.
  • data_format (str) – (optional) Choose between json and xml format. Older firmwares have problems with the JSON output format, defaults to json.
_login()[source]

Retrieve and set api_key for further authentication.

_request(operation, payload={})[source]

Send request to API, return result data.

Parameters:
  • operation (str) – Operation to request from the API.
  • payload (dict) – Dict key:value pairs to send as POST data to API.
_string2bool(string)[source]

Converts ‘true’ to True, ‘false’ to False and returns anything else.

_valid_key(api_key=None)[source]

Test if api_key is valid.

input_by_input_name(input_name)[source]

Lookup input_id (e.g. net_stream1) by configure input name.

input_by_output_name(output_name)[source]

Lookup input_id by configured output name.

input_by_output_param(output_param_name, output_param_value, partial=False, include_value=False)[source]

Lookup input_id by output config paramater.

Parameters:
  • output_param_name (str) – Name of output config parameter
  • output_param_value (str) – Value of parameter
  • partial (bool) – (optional) Allow for partial matches, defaults to False
  • include_value – (optional) Include param value(s) in output, useful with partial, defaults to False
input_config(input_id)[source]

Return dict of input stream config variables.

list_inputs()[source]

Return list of configured inputs.

list_outputs(input_id)[source]

Return list of outputs configured for input_id.

output_config(input_id, output_name)[source]

Return dict of output stream config variables.

read_service_log(service_name)[source]

Retrieve log lines for service or stream.

Parameters:service_name (str) – Name of service for which to retrieve logs
Result:A list of log lines.
Return type:list
reboot_device()[source]

Reboot the DVEO device.

reset_service(service_name)[source]

Kill and restart a service.

restart_all_streams()[source]

Kill and restart all the active streams.

restart_service(service_name)[source]

Restart service (without killing).

service_status(service_name)[source]

Return status line of service (daemon or stream) as string.

start_service(service_name)[source]

Start service.

stop_service(service_name)[source]

Stop service.

system_status()[source]

Return dict of system status information.

Utility functions

Various utility functions for use with the DVEO API module

dveo.utils.parse_xsd(xml)[source]

Parses API xsd document from xml string.

Parameters:xml (str) – XSD document in string form
Returns:dict with operations: parameters
Return type:dict

Indices and tables