Skip to content

Commit

Permalink
Merge pull request #32 from dglloyd/patch-1
Browse files Browse the repository at this point in the history
Raise exception on non-200 login requests
  • Loading branch information
gotlium authored Jan 12, 2017
2 parents effcea0 + 2db12b9 commit 1c6f43d
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions mattermost_bot/mattermost.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,12 @@ def login(self, name, email, password):
self.url + '/users/login', data=json.dumps(props),
verify=self.ssl_verify
)
self.token = p.headers["Token"]
self.load_initial_data()
return json.loads(p.text)
if p.status_code == 200:
self.token = p.headers["Token"]
self.load_initial_data()
return json.loads(p.text)
else:
p.raise_for_status()

def load_initial_data(self):
self.initial = self.get('/users/initial_load')
Expand Down

0 comments on commit 1c6f43d

Please sign in to comment.