Login

konkr.com API detect is spam - lastest

Author:
magik_cypress
Posted:
November 25, 2011
Language:
Python
Version:
1.3
Tags:
spam api web-services konkr
Score:
0 (after 0 ratings)

Detect Spam or Ham with a konkr web-service

https://konkr.com/api-documentation

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#! /usr/bin/python2.6

import os, json, simplejson, datetime, time, urllib, urllib2
from socket import gethostname, gethostbyname

class MiniAkismet:
    def __init__(self, akk=None, aip=None, con=None, usa=None):
    	self.api_konkr_key = akk
    	self.author_ip = aip
    	self.content = con
    	self.user_agent = usa

    def submit_data(self):
		try:
			url = "http://%s.api.konkr.com/isspam" % (self.api_konkr_key)
			headers = {'User-Agent' : self.user_agent}      
			data = {'author_ip': self.author_ip, 'content': self.content}
			data_encode = urllib.urlencode(data)
			req = urllib2.Request(url, data_encode, headers)		
			h = urllib2.urlopen(req)
			resp = h.read()
			msg = resp     
		except: 
			msg = 'Error detect spam'

		print msg

api_konkr_key = '1eee28f67868'
author_ip = gethostbyname(gethostname())
spam = 'Sex viagra porn Sarkozy clocking and enlarge your very little penis'
ham = 'konkr/alpha by Toorop with Protecmail.com, le must du filtrage des spams pour blog et pour email'
user_agent = "Mozilla/5.0 (X11; U; Linux i686) Gecko/20071127 Firefox/2.0.0.11"  

submit = MiniAkismet(api_konkr_key, author_ip, ham, user_agent)
if submit.submit_data():
	print 'End ham submit'

More like this

  1. konkr.com API detect is spam by magik_cypress 3 years, 7 months ago
  2. Bit.ly url shortener by BluePeppers 4 years, 7 months ago
  3. django soaplib test client by erny 6 years, 3 months ago
  4. Custom requests auth class for Tastypie API key authentication by jezdez 3 years, 3 months ago
  5. Web crawler/bot detection and blocking middleware by haloween 5 years, 5 months ago

Comments

Please login first before commenting.