upnpy.ssdp package

Submodules

upnpy.ssdp.SSDPDevice module

class upnpy.ssdp.SSDPDevice.SSDPDevice(address, response)

Bases: object

Represents an SSDP device

Object for representing an SSDP device.

Parameters
  • address (tuple) – SSDP device address

  • response (str) – Device discovery response data

class Service(service, service_id, scpd_url, control_url, event_sub_url, base_url)

Bases: object

Device service

Represents a service available on the device.

Parameters
  • service (str) – Full service string (e.g.: urn:schemas-upnp-org:service:WANIPConnection:1)

  • service_id (str) – ID of the service

  • scpd_url (str) – SCPD URL of the service

  • control_url (str) – Control URL of the service

  • event_sub_url (str) – Event Sub URL of the service

  • base_url (str) – Base URL of the service

class Action(name, argument_list, service)

Bases: object

Represents an action on a service

This class holds the details of a specific action available on a service.

Parameters
  • name (str) – Name of the action

  • argument_list (list) – List of in / out arguments the action has

  • service (SSDPDevice.Service) – The service to which this action belongs

class Argument(name, direction, return_value, related_state_variable)

Bases: object

Represents an argument for an action

This class holds the details of an argument for an action.

Parameters
  • name (str) – Name of the argument

  • direction (str) – Direction of the argument (in/out)

  • return_value (str) – Identifies at most one output argument as the return value

  • related_state_variable – Defines the type of the argument

get_input_arguments()

Get the input arguments for the action

Gets the input arguments for the action.

Returns

List of input arguments for the action

Return type

list

get_output_arguments()

Get the output arguments for the action

Gets the output arguments for the action.

Returns

List of output arguments for the action

Return type

list

class StateVariable(name, data_type, allowed_value_list=None)

Bases: object

get_actions()

Return a list of actions available for the service

Returns a list of available actions for the service.

Returns

List of actions available for this service

Return type

list

get_friendly_name()

Get the friendly name for the device

Gets the device’s friendly name

Returns

Friendly name of the device

Return type

str

get_services()

Return a list of services available for the device

Returns a list of available services for the device.

Returns

List of services available for this device

Return type

list

upnpy.ssdp.SSDPHeader module

class upnpy.ssdp.SSDPHeader.SSDPHeader(**headers)

Bases: object

set_header(name, value)
set_headers(**headers)
set_method(method)

upnpy.ssdp.SSDPRequest module

class upnpy.ssdp.SSDPRequest.SSDPRequest(ssdp_mcast_addr='239.255.255.250', ssdp_port=1900, **headers)

Bases: upnpy.ssdp.SSDPHeader.SSDPHeader

Create and perform an SSDP request

Parameters

method – SSDP request method [M-SEARCH or NOTIFY]

Perform an M-SEARCH SSDP request

Send an SSDP M-SEARCH request for finding UPnP devices on the network.

Parameters
  • discover_delay (int) – Device discovery delay in seconds

  • st (str) – Specify device Search Target

  • headers (str) – Specify M-SEARCH specific headers

Returns

List of device that replied

Return type

list

notify(**headers)

Perform a NOTIFY SSDP request

Parameters

headers – Specify NOTIFY specific headers

Returns

Module contents