Skip to content

Commit

Permalink
[#166] Fix login on older MW versions
Browse files Browse the repository at this point in the history
Attempting to fetch a login token will raise an APIError on older
MediaWiki versions (tested on v1.20.2), so we need to catch it.
  • Loading branch information
John Greeley authored and danmichaelo committed Jul 31, 2017
1 parent 1650e0e commit f1dc1c2
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion mwclient/client.py
Expand Up @@ -507,7 +507,7 @@ def login(self, username=None, password=None, cookies=None, domain=None):
# have to try. If the attempt fails, we try the old method.
try:
kwargs['lgtoken'] = self.get_token('login')
except KeyError:
except (errors.APIError, KeyError):
log.debug('Failed to get login token, MediaWiki is older than 1.27.')

while True:
Expand Down

0 comments on commit f1dc1c2

Please sign in to comment.