Skip to content

Instantly share code, notes, and snippets.

@tripleee
Created November 23, 2017 04:54
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save tripleee/f586ea491298e401d860b17483bcf99e to your computer and use it in GitHub Desktop.
SmokeDetector local dry run
#!/usr/bin/env python3
"""
dry-run.py: run findspam analysis on JSON posts from search.
"""
import json
from sys import argv
"""
# Mock globalvars
class globalvars ():
GlobalVars = {}
"""
from classes import Post
import spamhandling
for filename in argv[1:]:
with open(filename, 'r') as fh:
posts = json.loads(fh.read())
for postdict in posts:
post = Post(api_response=postdict)
verdict, reason, why = spamhandling.check_if_spam(post)
print(post['post_id'], verdict, reason, why)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment