Login

konkr.com API detect is spam

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
37
38
39
#! /usr/bin/python2.6

import json, simplejson, datetime, time, urllib2

def get_content():
	try:
		url = "http://en.lipsum.com/feed/json?amount=1"
		file = urllib2.urlopen(url)
		content = file.read()
		if content is not None:  
			json = simplejson.loads(content)
			out = json['feed']['lipsum']
	except: 
		out = 'Error content'
	return out	

def main(CONTENT):
    try:
        url = "http://%s.api.konkr.com/isspam?author_ip='%s'&content='%s'" % (API_KONKR_KEY, AUTHOR, CONTENT)
        file = urllib2.urlopen(url)
        data = file.read()
        if data:
			json = simplejson.loads(data)              
			msg = json['success']
    except: 
        msg = 'Error detect spam'

    print msg

if __name__ == "__main__":
	API_KONKR_KEY = 'your_key'
	AUTHOR = '127.0.0.1'
	SPAM = 'Sex viagra porn Sarkozy clocking and enlarge your very little penis'
	HAM = get_content()

	print 'Detect ham'
	main(HAM)  
	print 'Detect spam'
	main(SPAM) 

More like this

  1. konkr.com API detect is spam - lastest 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.