Last active
August 29, 2015 14:04
-
-
Save Pavelovich/9f3ec396338ec9f0ec87 to your computer and use it in GitHub Desktop.
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/python | |
# -*- coding: utf-8 -*- | |
import requests | |
import time | |
import datetime | |
def saloonBarReq(): | |
reqData = {"action" : "raw"} | |
reqHeaders = {"User-Agent":"Saloon Bar scanner: Sokolovskaya, Checking Rational Wiki Saloon Bar for evidence of harassment, sokolovskaya.akula.sturmkrieg.ru in Dallas, Texas"} | |
req = requests.post("http://rationalwiki.org/wiki/RationalWiki:Saloon_bar", data=reqData, headers=reqHeaders) | |
req.encoding = "utf-8" | |
return req.content | |
req = saloonBarReq() | |
def checkWord(word): | |
if ( word in req.lower() ): | |
print word.upper() +": TRUE" | |
return True | |
else: | |
print word.upper() +": FALSE" | |
return False | |
wordList = ["ehrenstein", " ie ", "inquisitor", "sasha", "lieutenant s", "reznov", "dondrekhan", "dewey", "nazi", "rape"] | |
while True: | |
t = time.localtime() | |
timestamp = "\n"+ time.asctime(t) | |
print timestamp | |
file = open("saloonbar_log.txt", 'a') | |
text = "\n\n"+ timestamp +"\n"+ req +"" | |
file.write(text) | |
file.close() | |
for word in wordList: | |
check = checkWord(word) | |
if ( check == True ): | |
file = open("saloonbar_log.txt", 'a') | |
text = word.upper() +": TRUE\n" | |
file.write(text) | |
file.close() | |
else: | |
file = open("saloonbar_log.txt", 'a') | |
text = word.upper() +": FALSE\n" | |
file.write(text) | |
file.close() | |
time.sleep(600) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment