Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

calling logout() results in error 400 #20

Open
kinslayer1982 opened this issue Mar 6, 2021 · 2 comments
Open

calling logout() results in error 400 #20

kinslayer1982 opened this issue Mar 6, 2021 · 2 comments

Comments

@kinslayer1982
Copy link

Hey,

for periodic requests to the unifi controller I made a script that logs in, fetches the required data and logs out. Everything works up to calling client.logout(), then I get the following:

Traceback (most recent call last):
File "test.py", line 12, in
client.logout()
File "/home/sensor_bot/.local/share/virtualenvs/sensor_bot-ejTj32CH/lib/python3.7/site-packages/unificontrol/metaprogram.py", line 125, in wrapper
return instance(client, *a, **kw)
File "/home/sensor_bot/.local/share/virtualenvs/sensor_bot-ejTj32CH/lib/python3.7/site-packages/unificontrol/metaprogram.py", line 103, in call
return client._execute(url, self._method, rest_dict, need_login=self._need_login)
File "/home/sensor_bot/.local/share/virtualenvs/sensor_bot-ejTj32CH/lib/python3.7/site-packages/unificontrol/unifi.py", line 115, in _execute
raise UnifiTransportError("{}: {}".format(resp.status_code, resp.reason))
unificontrol.exceptions.UnifiTransportError: 400:

Running the unifi controller on a raspberry pi, controller version: 6.0.45. Python 3.7

@GabrielRRussell
Copy link

Hmm... I'm having the same issue right now. It's a bit perplexing. It sounds stupid but honestly I found it easiest to just delete the current client, and recreate it. I need to actually test it out with multiple controllers, as my use case it like five of them, but so far it seems I'm able to log in, delete the client, re-initialize it, and it works just fine. Not sure if I'll run into any issues but if I do I will write it down here.

@SKSEffertz
Copy link

I had the same issue with the logout function. I compared the function call to the PHP version and the PHP version uses the POST method. This library uses the GET message.

Adding method="post", to the definition fixed it for me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants