Nekmo/python-akismet

Submit spam/ham - no return value

shacker opened this issue · 2 comments

.check() seems to work fine (I get back True/False) but submit_spam() and submit_spam() have no return value, so it's unclear whether they worked or not. No errors, just nothing. Should I assume this means the submissions were successful? It would be handy to have a return value to work with, so we could:

if submit_spam(...):
    // Do something

Realizing now that there is a Python akismet lib by ubernostrum, who is a Django core developer. Seems very well documented and maintained. No offense, but I'm going to switch to using that one.

http://akismet.readthedocs.io/en/1.0.1/index.html

Nekmo commented

If it does not work, the library returns an exception. Checking if something has worked for what the method returns, is a fudge.

        parameters = self._get_parameters(locals())
        r = self._request(self.get_submit_spam_url() if is_spam else self.get_submit_ham_url(), parameters)
        if r.text != "Thanks for making the web a better place.":
            raise AkismetServerError("Akismet server returned an error: {0}".format(r.text))