upnp.HTTP module

class upnp.HTTP.DescriptionAnswer(request, upnp)

Bases: upnp.HTTP.HttpAnswer

HTTP success, describe a device (XML)

describeDevice(device)

Add a device description to the answer

Parameters:device (upnp.Objects.Device) – Device to describe
describeIcon(icon)

Add an icon description to the answer

Parameters:icon (upnp.Objects.Icon) – Icon to describe
describeService(service)

Add a service description to the answer

Parameters:service (upnp.Objects.Service) – Service to describe
execute()

Prepare the description answer

class upnp.HTTP.HTTP(annoncer, port, netbind)

Bases: object

The main HTTP server class

dispose()

Close HTTP handling

initLoop(loop)

Add HTTP handlers on the asyncio loop

Parameters:loop (asyncio.AbstractEventLoop) – Loop to use
class upnp.HTTP.HttpAnswer(request)

Bases: object

Class to construct an HTTP response

execute()

Need to be overrided by subclass. It’s the execute process.

pprint()

Show the packet as human readable

write(writer)

Send the response

Parameters:writer (asyncio.StreamWriter) – Writer to send pakcet
class upnp.HTTP.HttpRequest(method, path, version, headers)

Bases: object

HTTP Request informations

pprint()

Print human readable request

class upnp.HTTP.HttpServer(config)

Bases: object

class to handle asyncio events on HTTP service

HttpRouting(request)

A simple routing by path for incomming requests

Parameters:request (upnp.HTTP.HttpRequest) – The incomming request
Returns:The answer to execute
Return type:upnp.HTTP.HttpAnswer
InConnection(reader, writer)

A new incomming connection

Parameters:
  • reader (asyncio.StreamReader) – Request input
  • writer (asyncio.StreamWriter) – Stream to answer
class upnp.HTTP.ScpdAnswer(request, upnp)

Bases: upnp.HTTP.HttpAnswer

HTTP success, Describe a service API

execute()

Prepare the answer

class upnp.HTTP.ServerErrorAnswer(request)

Bases: upnp.HTTP.HttpAnswer

HTTP error response

execute()

Prepare the response