Reference

TecoRoute Proxy.

Example of synchronous run:

from tecoroute_proxy import ProxyServer

server = ProxyServer(port=8080)
server.run()

Example of asynchronous run:

from asyncio import run

from tecoroute_proxy import ProxyServer

server = ProxyServer(port=8080)
run(server.run_async())

Example of asynchronous server startup:

from asyncio import ensure_future, get_event_loop

from tecoroute_proxy import ProxyServer

async def main():
    server = ProxyServer(port=8080)
    await server.start()

ensure_future(main())
get_event_loop().run_forever()
class tecoroute_proxy.ProxyServer(host: Optional[str] = None, port: int = 80, control: str = '/TR_PROXY', origin: str = 'http://route.tecomat.com:61682')

Proxy server.

Parameters
  • host – The host to listen on, all interfaces if None.

  • port – The port to listen on.

  • control – The control path.

  • origin – TecoRoute service URL.

async start() None

Start the server asynchronously in the event loop.

async run_async() None

Run the server asynchronously.

run() None

Run the server synchronously.

class tecoroute_proxy.ProxyRequest(request: aiohttp.web_request.Request, origin: str = 'http://route.tecomat.com:61682')

Client request.

Parameters
  • request – User request.

  • origin – TecoRoute service URL.

async login(username: str, password: str, plc: str) aiohttp.web_response.Response

Clear client cookies, save credentials and login.

Parameters
  • username – TecoRoute username.

  • password – TecoRoute password.

  • plc – TecoRoute plc.

async logout() aiohttp.web_response.Response

Delete credentials and logout.

async response() aiohttp.web_response.Response

Make a proxy request and get a response.

async close() None

Close request.

tecoroute_proxy.cli() None

Run the command-line interface.