meraki / dashboard-api-python

Official Dashboard API library (SDK) for Python
MIT License
289 stars 151 forks source link

getNetworkWirelessSsidFirewallL3Rules not working #194

Closed mpbs-npappin closed 2 years ago

mpbs-npappin commented 2 years ago

Working in meraki-1.20.0 broken in meraki-1.22.1.

dashboard.wireless.getNetworkWirelessSsidFirewallL3FirewallRules(networkId=networkId, number=1)

Stack Trace: Traceback (most recent call last): File "/opt/homebrew/Cellar/python@3.9/3.9.13_1/Frameworks/Python.framework/Versions/3.9/lib/python3.9/runpy.py", line 197, in _run_module_as_main return _run_code(code, main_globals, None, File "/opt/homebrew/Cellar/python@3.9/3.9.13_1/Frameworks/Python.framework/Versions/3.9/lib/python3.9/runpy.py", line 87, in _run_code exec(code, run_globals) File "/Users/npappin/.vscode/extensions/ms-python.python-2022.10.1/pythonFiles/lib/python/debugpy/adapter/../../debugpy/launcher/../../debugpy/main.py", line 39, in cli.main() File "/Users/npappin/.vscode/extensions/ms-python.python-2022.10.1/pythonFiles/lib/python/debugpy/adapter/../../debugpy/launcher/../../debugpy/../debugpy/server/cli.py", line 430, in main run() File "/Users/npappin/.vscode/extensions/ms-python.python-2022.10.1/pythonFiles/lib/python/debugpy/adapter/../../debugpy/launcher/../../debugpy/../debugpy/server/cli.py", line 284, in run_file runpy.run_path(target, run_name="main") File "/Users/npappin/.vscode/extensions/ms-python.python-2022.10.1/pythonFiles/lib/python/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_runpy.py", line 321, in run_path return _run_module_code(code, init_globals, run_name, File "/Users/npappin/.vscode/extensions/ms-python.python-2022.10.1/pythonFiles/lib/python/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_runpy.py", line 135, in _run_module_code _run_code(code, mod_globals, init_globals, File "/Users/npappin/.vscode/extensions/ms-python.python-2022.10.1/pythonFiles/lib/python/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_runpy.py", line 124, in _run_code exec(code, run_globals) File "/Users/npappin/projects/merakiCheck/check.py", line 248, in main() File "/Users/npappin/projects/merakiCheck/check.py", line 134, in main guestLayer3Rules = dashboard.wireless.getNetworkWirelessSsidFirewallL3FirewallRules(networkId=networkId, number=wirelessNetwork['number']) File "/Users/npappin/projects/merakiCheck/venv/lib/python3.9/site-packages/meraki/api/wireless.py", line 1506, in getNetworkWirelessSsidFirewallL3FirewallRules

File "/opt/homebrew/Cellar/python@3.9/3.9.13_1/Frameworks/Python.framework/Versions/3.9/lib/python3.9/urllib/parse.py", line 871, in quote return quote_from_bytes(string, safe) File "/opt/homebrew/Cellar/python@3.9/3.9.13_1/Frameworks/Python.framework/Versions/3.9/lib/python3.9/urllib/parse.py", line 896, in quote_from_bytes raise TypeError("quote_from_bytes() expected bytes") TypeError: quote_from_bytes() expected bytes

webfrank commented 2 years ago

Hi, the issue is related to type checking for SSID number, which now should be a string.

The real issue is that dashboard.wireless.getNetworkWirelessSsids(networkId=netId) returns the SSID number as number and if you automate everything you should now convert number to string to use all the other methods which require the SSID number.

I hope this will be fixed soon returning SSID number as string or allowing SSID number to be a number.

TKIPisalegacycipher commented 2 years ago

If you instead call dashboard.wireless.getNetworkWirelessSsidFirewallL3FirewallRules(networkId=networkId, number="1") (note that I'm passing 1 as a string, here) then do you have this issue?

mpbs-npappin commented 2 years ago

That works the code modification was wrapping the variable in a string object (str(variable)).

That works for the moment.

TKIPisalegacycipher commented 2 years ago

@mpbs-npappin please try again with version 1.24.0.