From d4ba7c1f6be0c9607cb6377c5a0eaab09e160158 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Dan=20Michael=20O=2E=20Hegg=C3=B8?= <danmichaelo@gmail.com>
Date: Tue, 16 May 2017 23:25:25 +0200
Subject: [PATCH] Handle errors in Site.get_token()

---
 mwclient/client.py | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/mwclient/client.py b/mwclient/client.py
index 916555b..0424395 100644
--- a/mwclient/client.py
+++ b/mwclient/client.py
@@ -536,6 +536,8 @@ class Site(object):
                 # protected and we're trying to fetch a login token.
                 info = self.raw_api('query', 'GET', meta='tokens', type=type)
 
+                self.handle_api_result(info)
+
                 # Note that for read protected wikis, we don't know the version when
                 # fetching the login token. If it's < 1.27, the request below will
                 # raise a KeyError that we should catch.
-- 
GitLab