Created
November 23, 2017 04:54
Star
You must be signed in to star a gist
SmokeDetector local dry run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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