def get_inbound_steem_transfers(account_name): nodes = ['https://api.steemit.com', 'https://gtg.steem.house:8090'] set_shared_steemd_instance(Steemd(nodes=nodes)) acc = Account('greenman') def filter(t): return t['to'] == account_name and float( t['amount'].split(' ')[0]) > .1 return [t for t in acc.history(filter_by=['transfer']) if filter(t)]
def override_steemd(): """override steemd node list for this worker""" from steem.steemd import Steemd from steem.instance import set_shared_steemd_instance global _custom_node if not _custom_node: steemd_nodes = [ # GOLOS node os.getenv('GOLOS_NODE', 'https://ws.golos.io'), ] set_shared_steemd_instance(Steemd(nodes=steemd_nodes)) _custom_node = True
from steem.blog import Blog from steembase.exceptions import PostDoesNotExist from textblob import TextBlob from sklearn.feature_extraction.text import CountVectorizer, TfidfTransformer from sklearn.naive_bayes import MultinomialNB from sklearn.svm import SVC, LinearSVC, NuSVC from sklearn.model_selection import train_test_split from sklearn.metrics import confusion_matrix import matplotlib.pyplot as plt from bs4 import BeautifulSoup steemd_nodes = [ 'https://api.steemit.com/', 'https://gtg.steem.house:8090/', 'https://steemd.steemitstage.com/', 'https://steemd.steemgigs.org/' ] set_shared_steemd_instance(Steemd(nodes=steemd_nodes)) # private posting key from environment variable POSTING_KEY = os.getenv('POMOCNIK_POSTING_KEY') # removes markdown and html tags from text def remove_html_and_markdown(text): return ''.join(BeautifulSoup(text, 'lxml').findAll(text=True)) def replace_white_spaces_with_space(text): return text.replace('\t', ' ').replace('\r', ' ').replace('\n', ' ') def get_message_from_post(post):
import os # Here you can modify the bot's prefix and description and wether it sends help in direct messages or not. @client.command is strongly discouraged, edit your commands into the command() function instead. client = Bot(description="Server-Management-Bot", command_prefix='!', pm_help=True) s = Steem() steemd_nodes = [ 'https://api.steemit.com/', 'https://gtg.steem.house:8090/', 'https://steemd.steemitstage.com/', 'https://steemd.steemgigs.org/' 'https://steemd.steemit.com/', ] set_shared_steemd_instance(Steemd(nodes=steemd_nodes)) # set backup API nodes cmc = Market() # Coinmarketcap API call. ste_usd = cmc.ticker("steem", limit="3", convert="USD")[0].get("price_usd", "none") sbd_usd = cmc.ticker("steem-dollars", limit="3", convert="USD")[0].get("price_usd", "none") react_dict = {} bot_role = 'marshal' # Set a role for all of your bots here. You need to give them such role on the discord server. allowed_channels = [ '402402513321721857', #review-linkdrop '399691348028030989' # testing: ]
set_check_point, get_check_point, get_current_block_num, get_swm_tag, NoSWMTag ) steem = Steem(['https://api.steemit.com/', 'https://appbasetest.timcliff.com/', 'https://steemd.minnowsupportproject.org/', 'https://steemd.privex.io/', 'https://anyx.io', 'https://api.steem.house/'], maxsize=100) set_shared_steemd_instance(steem) blockchain = Blockchain() def stream(BLOCK_NUM=None): if BLOCK_NUM is None: BLOCK_NUM = get_check_point('last_block') or get_current_block_num() print(f'START STREAMING FROM BLOCK: {BLOCK_NUM}') for op in blockchain.stream(start_block=BLOCK_NUM): op_type = op['type'] def construct_identifier(): return '@%s/%s' % ( op.get('author', op.get('comment_author')),
from steem.steemd import Steemd from steem import Steem from steem.instance import set_shared_steemd_instance from steem.account import Account from steembase.account import PrivateKey from steembase.exceptions import AccountDoesNotExistsException nodes = ['http://steemd.pevo.science'] custom_instance = Steemd(nodes=nodes) set_shared_steemd_instance(custom_instance) s = Steem(nodes) w = s.wallet file = open("k", "r") for line in file: account_values = line.split(",") account = account_values[1].strip() key = account_values[0].strip() # print("key("+key+"),account("+account+")") try: acc = Account(account) privkey = PrivateKey(key) pubkey = privkey.pubkey print(account + "," + str(pubkey) + "," + str(privkey) + "," + str(w.getKeyType(acc, str(pubkey)))) except AccountDoesNotExistsException: print("account " + account + " does not exists")
'rest_framework.pagination.LimitOffsetPagination', 'PAGE_SIZE': 20 } import datetime DEPLOYMENT_DATETIME = environ.get('DEPLOYMENT_DATETIME', datetime.datetime.utcnow().isoformat()) GOOGLE_ANALYTICS_PROPERTY_ID = environ.get('GOOGLE_ANALYTICS_PROPERTY_ID') ROCKET_CHAT_LOGIN = environ.get('ROCKET_CHAT_LOGIN') ROCKET_CHAT_PASSWORD = environ.get('ROCKET_CHAT_PASSWORD') ROCKET_CHAT_URL = environ.get('ROCKET_CHAT_URL') STEEM_NODES = [node.strip() for node in environ.get('STEEM_NODES').split(',')] set_shared_steemd_instance(Steemd(nodes=STEEM_NODES)) STEEM_NODES = [node.strip() for node in environ.get('STEEM_NODES').split(',')] STEEM_ACCOUNT = environ.get('STEEM_ACCOUNT') STEEM_POSTING_KEY = environ.get('STEEM_POSTING_KEY') from steem.wallet import Wallet Wallet(keys=[STEEM_POSTING_KEY]) PROJECT_GITHUB_REPOSITORY_URL = environ.get('PROJECT_GITHUB_REPOSITORY_URL') if PROJECT_GITHUB_REPOSITORY_URL.endswith("/"): PROJECT_GITHUB_REPOSITORY_URL = PROJECT_GITHUB_REPOSITORY_URL[:-1] PROJECT_SLUG_ON_PAGE = environ.get('PROJECT_SLUG_ON_PAGE')
class SteemHelper: s = Steem(nodes=[CONST.STEEMIT_API, 'http://steemd.pevo.science']) set_shared_steemd_instance(s) c = Converter() def get_history(self, username): a = Account(username) history = a.history_reverse() count = 1 for item in history: if count > 3: break print(item) count = count + 1 def get_payout(self, username): b = Blog(username) posts = b.take(1) total_pending = 0 total_payout = 0 total_cur_payout = 0 total_promoted = 0 for post in posts: # Total pending value pending_val = post['pending_payout_value'].amount total_pending += pending_val # Total payout value payout_val = post['total_payout_value'].amount total_payout += payout_val # Total curator payout value cur_payout = post['curator_payout_value'].amount total_cur_payout += cur_payout # Total max accepted payout value promoted = post['promoted'].amount total_promoted += promoted total_pending = round(total_pending, 2) total_payout = round(total_payout, 2) total_cur_payout = round(total_cur_payout, 2) total_promoted = round(total_promoted, 2) result = { 'total_pending':"{} SBD".format(total_pending), 'total_payout':"{} SBD".format(total_payout), 'total_cur_payout':"{} SBD".format(total_cur_payout), 'total_promoted':"{} SBD".format(total_promoted) } return result def get_account(self, username): try: a = self.s.get_account(username) a['json_metadata'] = json.loads(a['json_metadata']) except: return None return a def get_follow_count(self, username): return self.s.get_follow_count(username) def get_followers(self, username): return self.s.get_followers(username, 'blog', 'abit', 0) def get_reputation(self, reputation): reputation = float(reputation) return "({})".format(str(math.floor((math.log10(reputation)-9) * 9 + 25))) def get_steem_power(self, vests): vests = float(vests.replace('VESTS','')) return "{} SP".format(round(self.c.vests_to_sp(vests),2)) def get_voting_power(self, vp): return "{}%".format(round(vp/100,2))