Skip to content

Commit

Permalink
Merge pull request #204 from TheLime1/master
Browse files Browse the repository at this point in the history
fixed `set_multi_macfilter_settings` documentation + added an example
  • Loading branch information
Salamek authored Jan 7, 2024
2 parents 045d10d + 3fb8adc commit 8f464b8
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 2 deletions.
28 changes: 28 additions & 0 deletions examples/mac_filter.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#!/usr/bin/env python3

"""
Example code To add a Mac address to your blocklist, you can try it by running:
python3 mac_filter.py http://192.168.8.1/ --username admin --password PASSWORD --mac 66:77:88:99:AA:BB --hostname fake_mac_adr --index 0 --status 2
"""

from argparse import ArgumentParser
from huawei_lte_api.Connection import Connection
from huawei_lte_api.api.WLan import WLan


parser = ArgumentParser()
parser.add_argument('url', type=str)
parser.add_argument('--username', type=str)
parser.add_argument('--password', type=str)
parser.add_argument('--mac', type=str)
parser.add_argument('--hostname', type=str)
parser.add_argument('--index', type=str)
parser.add_argument('--status', type=str)
args = parser.parse_args()
args = parser.parse_args()

with Connection(args.url, username=args.username, password=args.password) as connection:
wlan = WLan(connection)
clients = [{'WifiMacFilterMac0': args.mac,
'wifihostname0': args.hostname, 'Index': args.index, 'WifiMacFilterStatus': args.status}]
response = wlan.set_multi_macfilter_settings(clients)
3 changes: 1 addition & 2 deletions huawei_lte_api/api/WLan.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,8 +140,7 @@ def multi_macfilter_settings(self) -> GetResponseType:

def set_multi_macfilter_settings(self, clients: list) -> SetResponseType:
"""
:param clients: list of dicts with format {'wifihostname': hostname,'WifiMacFilterMac': mac}
:param clients: list of dicts with format {'WifiMacFilterMac0': 'mac address','wifihostname0': 'name', 'Index': 'number', 'WifiMacFilterStatus': 'number(1 or 2)'}
"""
return self._session.post_set('wlan/multi-macfilter-settings', {
'Ssids': {
Expand Down

0 comments on commit 8f464b8

Please sign in to comment.