Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Load blacklisted users & words from config file #10

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions config.sample
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,10 @@ consumer_key:
consumer_secret:
access_token:
access_token_secret:

# Leave blank if you don't want to blacklist any users or words
[preferences]
# blacklisted_users = ['example_user_1','example_user_2']
blacklisted_users = []
# blacklisted_words = ["example_word_1", "example_word_2"]
blacklisted_words = []
7 changes: 4 additions & 3 deletions retweet.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-

import os, ConfigParser, tweepy, inspect, hashlib
import os, ConfigParser, tweepy, inspect, hashlib, ast

path = os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe())))

Expand All @@ -14,8 +14,9 @@
tweetLanguage = config.get("settings","tweet_language")

# blacklisted users and words
userBlacklist = []
wordBlacklist = ["RT", u"♺"]
userBlacklist = ast.literal_eval(config.get("preferences", "blacklisted_users"))
wordBlacklist = ast.literal_eval(config.get("preferences", "blacklisted_words"))
wordBlacklist.extend(["RT", u"♺"])

# build savepoint path + file
hashedHashtag = hashlib.md5(hashtag).hexdigest()
Expand Down