finish06 / pyunifi

https://unifi-sdn.ubnt.com/
MIT License
223 stars 99 forks source link

create_voucher fail #86

Open Satzende opened 3 months ago

Satzende commented 3 months ago

Er kann sich einloggen aber einen voucher, kann er nicht setzen

c = Controller(host=myconf["unifi"]["ip"], version = myconf["unifi"]["version"],username=myconf["unifi"]["user"], password=myconf["unifi"]["pw"], ssl_verify=False) c.create_voucher(number="7777755555",quota="70",expire="60")

Fehler Meldung

/home/user/PycharmProjects/qrcode_unifi/venv/lib/python3.11/site-packages/urllib3/connectionpool.py:1103: InsecureRequestWarning: Unverified HTTPS request is being made to host '192.168.100.35'. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#tls-warnings warnings.warn( Failed to perform <function Controller._write at 0x7f073fcf7420> due to api.err.InvalidArgs Traceback (most recent call last): File "/home/user/PycharmProjects/qrcode_unifi/venv/lib/python3.11/site-packages/pyunifi/controller.py", line 31, in wrapper return func(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^ File "/home/user/PycharmProjects/qrcode_unifi/venv/lib/python3.11/site-packages/pyunifi/controller.py", line 151, in _write return self._jsondec(response.text) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/user/PycharmProjects/qrcode_unifi/venv/lib/python3.11/site-packages/pyunifi/controller.py", line 120, in _jsondec raise APIError(obj["meta"]["msg"]) pyunifi.controller.APIError: api.err.InvalidArgs

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/home/user/PycharmProjects/qrcode_unifi/venv/lib/python3.11/site-packages/pyunifi/controller.py", line 36, in wrapper return func(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^ File "/home/user/PycharmProjects/qrcode_unifi/venv/lib/python3.11/site-packages/pyunifi/controller.py", line 151, in _write return self._jsondec(response.text) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/user/PycharmProjects/qrcode_unifi/venv/lib/python3.11/site-packages/pyunifi/controller.py", line 120, in _jsondec raise APIError(obj["meta"]["msg"]) pyunifi.controller.APIError: api.err.InvalidArgs

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/home/user/PycharmProjects/qrcode_unifi/main.py", line 99, in c.create_voucher(number="7777755555",quota="70",expire="60") File "/home/user/PycharmProjects/qrcode_unifi/venv/lib/python3.11/site-packages/pyunifi/controller.py", line 832, in create_voucher res = self._run_command(cmd, mgr="hotspot", params=params) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/user/PycharmProjects/qrcode_unifi/venv/lib/python3.11/site-packages/pyunifi/controller.py", line 306, in _run_command return self._api_write("cmd/" + mgr, params=params) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/user/PycharmProjects/qrcode_unifi/venv/lib/python3.11/site-packages/pyunifi/controller.py", line 154, in _api_write return self._write(self._api_url() + url, params) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/user/PycharmProjects/qrcode_unifi/venv/lib/python3.11/site-packages/pyunifi/controller.py", line 38, in wrapper raise APIError(err) pyunifi.controller.APIError: api.err.InvalidArgs

Process finished with exit code 1