fixing those two python files

This commit is contained in:
Alex Barcelo 2016-10-24 10:05:41 +02:00
parent 179ceb2f82
commit f017adea63
2 changed files with 47 additions and 46 deletions

View File

@ -31,7 +31,7 @@ The default is : ::
Whatever you pass in, will replace the *Python Interface by Fuzzyman* part. Whatever you pass in, will replace the *Python Interface by Fuzzyman* part.
**0.2.0** will change with the version of this interface. **0.2.0** will change with the version of this interface.
Usage example:: Usage example:
from akismet import Akismet from akismet import Akismet
@ -70,7 +70,7 @@ __all__ = (
'Akismet', 'Akismet',
'AkismetError', 'AkismetError',
'APIKeyError', 'APIKeyError',
) )
__author__ = 'Michael Foord <fuzzyman AT voidspace DOT org DOT uk>' __author__ = 'Michael Foord <fuzzyman AT voidspace DOT org DOT uk>'
@ -203,13 +203,13 @@ class Akismet(object):
worked out. worked out.
""" """
data['comment_content'] = comment data['comment_content'] = comment
if not 'user_ip' in data: if 'user_ip' not in data:
try: try:
val = os.environ['REMOTE_ADDR'] val = os.environ['REMOTE_ADDR']
except KeyError: except KeyError:
raise AkismetError("No 'user_ip' supplied") raise AkismetError("No 'user_ip' supplied")
data['user_ip'] = val data['user_ip'] = val
if not 'user_agent' in data: if 'user_agent' not in data:
try: try:
val = os.environ['HTTP_USER_AGENT'] val = os.environ['HTTP_USER_AGENT']
except KeyError: except KeyError:

View File

@ -109,6 +109,7 @@ def api_return(status, text='', json=False):
class API: class API:
def __init__(self, request): def __init__(self, request):
self.request = request self.request = request