Skip to content

Instantly share code, notes, and snippets.

@tripleee tripleee/dry-run.py
Created Nov 23, 2017

Embed
What would you like to do?
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
You can’t perform that action at this time.