1 Star 0 Fork 0

liuguilin / tplink-adapter

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
main.py 790 Bytes
一键复制 编辑 原始数据 按行查看 历史
Michael Stegeman 提交于 2020-10-05 11:47 . Drop Mozilla branding.
"""TP-Link adapter for WebThings Gateway."""
from os import path
import functools
import signal
import sys
import time
sys.path.append(path.join(path.dirname(path.abspath(__file__)), 'lib'))
from pkg.tplink_adapter import TPLinkAdapter # noqa
_DEBUG = False
_ADAPTER = None
print = functools.partial(print, flush=True)
def cleanup(signum, frame):
"""Clean up any resources before exiting."""
if _ADAPTER is not None:
_ADAPTER.close_proxy()
sys.exit(0)
if __name__ == '__main__':
signal.signal(signal.SIGINT, cleanup)
signal.signal(signal.SIGTERM, cleanup)
_ADAPTER = TPLinkAdapter(verbose=_DEBUG)
# Wait until the proxy stops running, indicating that the gateway shut us
# down.
while _ADAPTER.proxy_running():
time.sleep(2)
1
https://gitee.com/liu_guilin/tplink-adapter.git
git@gitee.com:liu_guilin/tplink-adapter.git
liu_guilin
tplink-adapter
tplink-adapter
master

搜索帮助