coapthon.reverse_proxy package

Submodules

coapthon.reverse_proxy.coap module

class coapthon.reverse_proxy.coap.CoAP(server_address, xml_file, multicast=False, starting_mid=None, cache=False, sock=None)[source]

Bases: object

Implementation of the Reverse Proxy

add_resource(path, resource)[source]

” Helper function to add resources to the resource directory during server initialization.

Parameters:
  • path – the path for the new created resource
  • resource (Resource) – the resource to be added
close()[source]

Stop the server.

discover_remote(destination, name)[source]

Discover resources on remote servers.

Parameters:
  • destination (tuple) – the remote server (ip, port)
  • name (String) – the name of the remote server
discover_remote_results(response, name)[source]

Create a new remote server resource for each valid discover response.

Parameters:
  • response – the response to the discovery request
  • name – the server name
listen(timeout=10)[source]

Listen for incoming messages. Timeout is used to check if the server must be switched off.

Parameters:timeout – Socket Timeout in seconds
parse_config()[source]

Parse the xml file with remote servers and discover resources on each found server.

Parse discovery results.

Parameters:
  • link_format – the payload of the response to the discovery request
  • base_path – the base path used to create child resources discovered on the remote server
  • remote_server – the (ip, port) of the remote server
purge()[source]

Clean old transactions

receive_datagram(args)[source]

Handle messages coming from the udp socket.

Parameters:args – (data, client_address)
send_datagram(message)[source]

Send a message through the udp socket.

Parameters:message (Message) – the message to send

Module contents