For some reason OtherPageSaveError is raised where I was excepting SpamfilterError.
>>> import pywikibot as pw;pw.Page(pw.Site(), 'user:framawiki/Brouillon3').put('https://bit.ly/test') WARNING: No user is logged in on site wikipedia:fr WARNING: No user is logged in on site wikipedia:fr Logging in to wikipedia:fr as Framawiki WARNING: API error spamblacklist: The text you wanted to save was blocked by the spam filter. This is probably caused by a link to a blacklisted external site. The following text is what triggered our spam filter: bit.ly/test Traceback (most recent call last): File "pywikibot/page/__init__.py", line 117, in handle func(self, *args, **kwargs) File "pywikibot/page/__init__.py", line 1316, in _save watch=watch, bot=botflag, **kwargs) File "pywikibot/site/__init__.py", line 1340, in callee return fn(self, *args, **kwargs) File "pywikibot/site/__init__.py", line 5383, in editpage result = req.submit() File "pywikibot/data/api.py", line 2092, in submit raise APIError(**result['error']) pywikibot.data.api.APIError: spamblacklist: The text you wanted to save was blocked by the spam filter. This is probably caused by a link to a blacklisted external site. The following text is what triggered our spam filter: bit.ly/test [spamblacklist: {'matches': ['bit.ly/test']}; help: See https://fr.wikipedia.org/w/api.php for API usage. Subscribe to the mediawiki-api-announce mailing list at <https://lists.wikimedia.org/mailman/listinfo/mediawiki-api-announce> for notice of API deprecations and breaking changes.] During handling of the above exception, another exception occurred: Traceback (most recent call last): File "<console>", line 1, in <module> File "pywikibot/tools/__init__.py", line 1790, in wrapper return obj(*__args, **__kw) File "pywikibot/tools/__init__.py", line 1790, in wrapper return obj(*__args, **__kw) File "pywikibot/page/__init__.py", line 1383, in put **kwargs) File "pywikibot/tools/__init__.py", line 1790, in wrapper return obj(*__args, **__kw) File "pywikibot/tools/__init__.py", line 1790, in wrapper return obj(*__args, **__kw) File "pywikibot/page/__init__.py", line 1305, in save cc=apply_cosmetic_changes, quiet=quiet, **kwargs) File "pywikibot/page/__init__.py", line 138, in wrapper handle(func, self, *args, **kwargs) File "pywikibot/page/__init__.py", line 130, in handle raise pywikibot.OtherPageSaveError(self, err) pywikibot.exceptions.OtherPageSaveError: Edit to page [[Utilisateur:Framawiki/Brouillon3]] failed: spamblacklist: The text you wanted to save was blocked by the spam filter. This is probably caused by a link to a blacklisted external site. The following text is what triggered our spam filter: bit.ly/test [spamblacklist: {'matches': ['bit.ly/test']}; help: See https://fr.wikipedia.org/w/api.php for API usage. Subscribe to the mediawiki-api-announce mailing list at <https://lists.wikimedia.org/mailman/listinfo/mediawiki-api-announce> for notice of API deprecations and breaking changes.]