Python包,允许管理tenda路由器AC15。

tendawifi的Python项目详细描述


天达wifi

一个简单的Python包,允许管理tenda路由器AC15。在

安装

    $ pip install tendawifi

美国石油学会

首先,它必须实例化一个TendaAC15对象:

如果它使用默认路由器ip“192.168.1.1”运行:

^{pr2}$

如果它使用自定义路由器ip运行:

>>>t=tendawifi.TendaAC15(url_base="10.0.0.1")>>>Password:

如果它在不询问密码的情况下运行:

>>>t=tendawifi.TendaAC15(url_base="10.0.0.1",password="YOURPASS")

目前,它具有以下特点:

通过MAC地址获取父控件配置

defget_parent_control(self,mac:str)->dict:"""    Return a dictionary of a Client Parent Control configuration.    Args:        mac:str: Client MAC address ex: "aa:bb:cc:dd:ee:ff"    Returns:        dict: {'enable': 1, 'mac': 'aa:bb:cc:dd:ee:ff', 'url_enable': 0, 'urls': '',        'time': '09:00-01:30', 'day': '1,1,1,1,1,1,1', 'limit_type': 1}    """

设置父控件配置MAC地址

defset_parent_control(self,mac:str,status:int)->str:"""    Set status of a Client Parent Control configuration.    Args:        mac:str: Client MAC address ex: "aa:bb:cc:dd:ee:ff"        status:int: Status of client Parent Control ex: 1 (enable) 0 (disable)    Returns:        str: Request response '{"errCode":0}'    """

获取虚拟服务器配置

defget_vports(self)->dict:"""    Return a dictionary of Virtual Server configuration.    Returns:        dict: {'lanIp': '192.168.1.1', 'lanMask': '255.255.255.0',            'virtualList': [{'ip': '192.168.1.100', 'inPort': '80', 'outPort': '80', 'protocol': '0'}, ...]}    """

设置虚拟服务器配置

defset_vports(self,vports_dict:dict)->str:"""    Set Virtual Server configuration from dictionary returned by get_vports() method.    Args:        vports_dict:list: List of Virtual Server settings.    Returns:        str: Request response '{"errCode":0}'    """

获取带宽控制配置

defget_net_control(self)->list:"""    Return a list of Bandwidth configuration.    Returns:        list: [{'netControlEn': '1'}, {'upSpeed': '0', 'downSpeed': '0', 'devType': 'unknown',            'hostName': 'ClientName', 'ip': '192.168.1.100', 'mac': 'aa:bb:cc:dd:ee:ff', 'limitUp': '0',            'limitDown': '0', 'isControled': '0', 'offline': '0', 'isSet': '0'}, ...]        """

设置带宽控制配置

defset_net_control(self,net_control:list)->str:"""    Set Bandwidth Control configuration from list returned by get_net_control() method.    Args:        net_control:list: List of Bandwidth settings.    Returns:        str: Request response '{"errCode":0}'    """

通过MAC地址获取DHCP保留配置

defget_ipmac_bind(self)->dict:"""    Return a dictionary of DHCP Reservation configuration.    Returns:        dict: {'lanIp': '192.168.1.1', 'lanMask': '255.255.255.0', 'dhttpIP': '172.27.175.218', 'dhcpClientList': [],            'bindList': [{'ipaddr': '192.168.1.100', 'macaddr': 'aa:bb:cc:dd:ee:ff', 'devname': 'ClientName', 'status': '1'}, ...]}    """

按MAC地址设置DHCP保留配置

defset_ipmac_bind(self,ipmac_bind_dict:dict)->str:"""    Set DHCP Reservation configuration from dictionary returned by get_ipmac_bind() method.    Args:        ipmac_bind_dict:dict: List of DHCP Reservation settings.    Returns:        str: Request response '{"errCode":0}'    """

按“devname”值筛选DHCP保留配置

deffilter_bindlist_by_devname(self,str_in_dev_name:str)->list:"""    Return a list of DHCP Reservation configuration filtered by 'devname' value if contains the str_in_dev_name param.    Returns:        list: [{'ipaddr': '192.168.1.100', 'macaddr': 'aa:bb:cc:dd:ee:ff', 'devname': 'ClientName', 'status': '1'}, ...]}    """

获取在线客户列表

defget_online_list(self)->list:"""    Return a list of online clients.    Returns:        list: [{"deviceId": "aa:bb:cc:dd:ee:ff", "ip": "192.168.1.100", "devName": "ClientName", "line": "2", "uploadSpeed": "0",                "downloadSpeed": "0", "linkType": "unknown", "black": 0, "isGuestClient": "false" }, ...]}    """

按“devName”值筛选联机客户端列表

deffilter_onlinelist_by_devname(self,str_in_dev_name:str)->list:"""    Return a list of online clients filtered by 'devname' value if contains the str_in_dev_name param.    Returns:        list: [{"deviceId": "aa:bb:cc:dd:ee:ff", "ip": "192.168.1.100", "devName": "ClientName", "line": "2", "uploadSpeed": "0",                "downloadSpeed": "0", "linkType": "unknown", "black": 0, "isGuestClient": "false" }, ...]}    """

重新启动路由器

defreboot(self):"""        Reboot the router        """

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
序列化反序列化java。awt。颜色>java。木卫一。InvalidClassException   java禁用多个日期范围jDateChooser   java为什么我的特例apper会被扔进泽西/灰熊?   JavaIntelliJ比较两个覆盖率数据   java什么是servletsdefault。你怎么办?   单击几下libgdx后java按钮没有响应   使用java将字符串转换为JSONArray   文件系统在java中刷新fileSystemViewer   java如何在hibernate中避免脏检查   java奇怪的问题,带有分号和“无法解决…”   java将值从子面板传递到父面板   HTML JTextPane CSS的Java FontSizeAction   java文件代码神秘地变成了一堆(0000)