Skip to content

Commit

Permalink
Consolidate branches and use json dump rather than str().
Browse files Browse the repository at this point in the history
  • Loading branch information
saroberts committed Dec 28, 2015
1 parent c8343f0 commit b42b7b9
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions unifi/controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,17 +143,14 @@ def _construct_api_path(self, version):
def _login(self, version):
log.debug('login() as %s', self.username)

params = {'username': self.username, 'password': self.password}
login_url = self.url

if version is 'v4':
login_url += 'api/login'
params = json.dumps(params)
else:
login_url += 'login'

params = {'username': self.username, 'password': self.password}

if version is 'v4':
params = str(params)
else:
params.update({'login': 'login'})
if PYTHON_VERSION is 2:
params = urllib.urlencode(params)
Expand Down

0 comments on commit b42b7b9

Please sign in to comment.