bug fix ak.baseurl set before ak initialized

This commit is contained in:
alligatorbait 2020-10-14 16:46:41 -06:00
parent 16c70d38cd
commit 628b734451

View File

@ -99,7 +99,6 @@ def text_is_spam(text, request):
if hasattr(settings, 'TYPEPAD_ANTISPAM_API_KEY'):
apikey = settings.TYPEPAD_ANTISPAM_API_KEY
ak.baseurl = 'api.antispam.typepad.com/1.1/'
elif hasattr(settings, 'PYTHON_AKISMET_API_KEY'):
# new env var expected by python-akismet package
apikey = settings.PYTHON_AKISMET_API_KEY
@ -114,6 +113,9 @@ def text_is_spam(text, request):
key=apikey,
)
if hasattr(settings, 'TYPEPAD_ANTISPAM_API_KEY'):
ak.baseurl = 'api.antispam.typepad.com/1.1/'
if ak.verify_key():
ak_data = {
'user_ip': request.META.get('REMOTE_ADDR', '127.0.0.1'),