Skip to content

Commit

Permalink
Add support for global blacklist api of themarkymark
Browse files Browse the repository at this point in the history
  • Loading branch information
emre committed Aug 26, 2018
1 parent 06724dd commit 9f62883
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
4 changes: 2 additions & 2 deletions setup.py
Expand Up @@ -2,7 +2,7 @@

setup(
name='steem_tagbot',
version='0.0.8',
version='0.0.9',
packages=["tagbot",],
url='http://github.com/emre/tagbot',
license='MIT',
Expand All @@ -14,5 +14,5 @@
'tagbot = tagbot.bot:main',
],
},
install_requires=["steem_dshot", "nltk"]
install_requires=["steem_dshot", "nltk", "requests"]
)
13 changes: 13 additions & 0 deletions tagbot/bot.py
Expand Up @@ -9,6 +9,7 @@
from steem.account import Account
from steem.post import Post
from steem.amount import Amount
import requests

from tagbot.utils import get_steem_conn, get_current_vp, url, reputation, tokenize

Expand Down Expand Up @@ -116,6 +117,11 @@ def fetch_tag(self, tag, start_author=None, start_permlink=None, posts=None, sca
scanned_pages=scanned_pages + 1,
)

def in_global_blacklist(self, author):
url = "http://blacklist.usesteem.com/user/" + author
response = requests.get(url).json()
return bool(len(response["blacklisted"]))

def start_voting_round(self):
posts = []
for tag in self.target_tags:
Expand Down Expand Up @@ -204,6 +210,13 @@ def start_voting_round(self):
)
continue

if self.in_global_blacklist(post.get("author")):
logger.info(
"Post: %s is skipped since it's blacklisted globally.",
post.identifier
)
continue

self.upvote(
Post(post, steemd_instance=self.steemd_instance),
self.config["VOTE_WEIGHT"]
Expand Down

0 comments on commit 9f62883

Please sign in to comment.