finish06 / pyunifi

https://unifi-sdn.ubnt.com/
MIT License
226 stars 100 forks source link

Unable to login on Controller v5.10 #32

Closed tchellomello closed 5 years ago

tchellomello commented 5 years ago
In [11]: ctrl = Controller(host, username, password, port, version='v4', site_id=site_id, ssl_verify=False)                    
/home/homeassistant/.virtualenvs/hass/lib64/python3.6/site-packages/urllib3/connectionpool.py:847: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings
  InsecureRequestWarning)
---------------------------------------------------------------------------
APIError                                  Traceback (most recent call last)
<ipython-input-11-f04d4ea99bd7> in <module>
----> 1 ctrl = Controller(host, username, password, port, version='v4', site_id=site_id, ssl_verify=False)

~/.virtualenvs/hass/lib64/python3.6/site-packages/pyunifi/controller.py in __init__(self, host, username, password, port, version, site_id, ssl_verify)
     87 
     88         log.debug('Controller for %s', self.url)
---> 89         self._login(version)
     90 
     91     def _jsondec(self, data):

~/.virtualenvs/hass/lib64/python3.6/site-packages/pyunifi/controller.py in _login(self, version)
    149 
    150         if r.status_code is not 200:
--> 151             raise APIError("Login failed - status code: %i" % r.status_code)
    152 
    153     def _logout(self):

APIError: Login failed - status code: 400

Same for v5:

In [13]: ctrl = Controller(host, username, password, port, version='v5', site_id=site_id, ssl_verify=False)                    
/home/homeassistant/.virtualenvs/hass/lib64/python3.6/site-packages/urllib3/connectionpool.py:847: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings
  InsecureRequestWarning)
---------------------------------------------------------------------------
APIError                                  Traceback (most recent call last)
<ipython-input-13-b48ed86d0681> in <module>
----> 1 ctrl = Controller(host, username, password, port, version='v5', site_id=site_id, ssl_verify=False)

~/.virtualenvs/hass/lib64/python3.6/site-packages/pyunifi/controller.py in __init__(self, host, username, password, port, version, site_id, ssl_verify)
     87 
     88         log.debug('Controller for %s', self.url)
---> 89         self._login(version)
     90 
     91     def _jsondec(self, data):

~/.virtualenvs/hass/lib64/python3.6/site-packages/pyunifi/controller.py in _login(self, version)
    149 
    150         if r.status_code is not 200:
--> 151             raise APIError("Login failed - status code: %i" % r.status_code)
    152 
    153     def _logout(self):

APIError: Login failed - status code: 400

CC: @finish06