Skip to content

Commit 346b109

Browse files
committed
Implement better error when /identify returns non-JSON
1 parent 4062702 commit 346b109

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

mwoauth/functions.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -256,6 +256,11 @@ def identify(mw_uri, consumer_token, access_token, leeway=10.0,
256256
raise OAuthException(
257257
"An error occurred while trying to read json " +
258258
"content: {0}".format(e))
259+
else:
260+
raise OAuthException(
261+
"Could not read response from 'Special:OAuth/identify'. " +
262+
"Maybe your MediaWiki is not configured correctly? " +
263+
"Expected JSON but instead got: {0!r}".format(r.content[:100]))
259264

260265
# Decode json & stuff
261266
try:

0 commit comments

Comments
 (0)