Site icon CleanTalk's blog

Perl, Python anti-spam API to web-site spam protection

Ready to use API for protecting web site from spam, to an existing class PHP, added antispam modules Perl and Python. Libraries enable you to check on the spam as a new comment and registration. Examples:

Perl API:

[perl]
use strict;
use WebService::Antispam;

my $ct = WebService::Antispam->new({
auth_key => ‘12345’ # API key, please get on cleantalk.org
});

my $response = $ct->request({
message => ‘abc’, # Comment visitor to the site
example => undef, # The text of the article to which visitor created a comment.
sender_ip => ‘196.19.250.114’, # IP address of the visitor
sender_email => ‘

st********@ex*****.com











‘, # Email IP of the visitor
sender_nickname => ‘spam_bot’, # Nickname of the visitor
submit_time => 12, # The time taken to fill the comment form in seconds
js_on => 1, # The presence of JavaScript for the site visitor, 0|1
});
[/perl]

Python API:

[python]
from cleantalk import CleanTalk

ct = CleanTalk(auth_key=’yourkey’)
ct_result = ct.request(
message = ‘abc’, # Visitor comment
sender_ip = ‘196.19.250.114’, # Visitor IP address
sender_email = ‘

st********@ex*****.com











‘, # Visitor email
sender_nickname = ‘spam_bot’, # Visitor nickname
js_on = 1, # Is visitor has JavaScript
submit_time = 12 # Seconds from start form filling till the form POST
)
#Check
if ct_result[‘allow’]:
print(‘Comment allowed. Reason ‘ + ct_result[‘comment’])
else:
print(‘Comment blocked. Reason ‘ + ct_result[‘comment’])
[/python]

Python module compatible with the version of Python 2 and Python release 3. Soon to be available API platform .NET.

Perl anti-spam module to the web site

Python anti-spam module to the web site

Perl, Python anti-spam API to web-site spam protection
Exit mobile version