pybitmessage.upnp module

Complete UPnP port forwarding implementation in separate thread. Reference: http://mattscodecave.com/posts/using-python-and-upnp-to-forward-a-port

createRequestXML(service, action, arguments=None)[source]

Router UPnP requests are XML formatted

exception UPnPError(message)[source]

Bases: exceptions.Exception

Handle a UPnP error

class Router(ssdpResponse, address)[source]

Encapulate routing

extPort = None
address = None
routerPath = None
name = ''
path = ''
AddPortMapping(externalPort, internalPort, internalClient, protocol, description, leaseDuration=0, enabled=1)

Add UPnP port mapping

DeletePortMapping(externalPort, protocol)

Delete UPnP port mapping

GetExternalIPAddress()

Get the external address

soapRequest(service, action, arguments=None)

Make a request to a router

class uPnPThread[source]

Bases: pybitmessage.network.threads.StoppableThread

Start a thread to handle UPnP activity

SSDP_ADDR = '239.255.255.250'
GOOGLE_DNS = '8.8.8.8'
SSDP_PORT = 1900
SSDP_MX = 2
SSDP_ST = 'urn:schemas-upnp-org:device:InternetGatewayDevice:1'
run()

Start the thread to manage UPnP activity

getLocalIP()

Get the local IP of the node

sendSearchRouter()

Querying for UPnP services

createPortMapping(router)

Add a port mapping

deletePortMapping(router)

Delete a port mapping