예제 #1
0
  def __init__(self):
    '''
    Unfortunately, we cannot instantiate CointipBot only once due to the way pifkoin works. 

    Pifkoin will open an HTTP connection to the RPC client which will eventually close when the bot completes its checks. Therefore, if we try to loop
    CointipBot.main() without reinstanting the object, httplib will throw BadStatusLine because the connection is no longer valid and cannot be used.

    May make a pull request to pifkoin to resolve this. If this does get resolved in pifkoin or you locally modify your pifkoin copy to resolve this, you can
    uncomment the following line and comment the self.cb assignment in main(). This will ensure we do not need to reinstantiate CoinbotTip in every iteration.
    '''
    self.cb = cointipbot.CointipBot()
예제 #2
0
import sys, os, datetime, logging
from distutils.spawn import find_executable
import cointipbot

logging.basicConfig()
lg = logging.getLogger('cointipbot')
lg.setLevel(logging.DEBUG)

if not len(sys.argv) in [2, 3] or not os.access(sys.argv[1], os.W_OK):
    print "Usage: %s DIRECTORY [RSYNC-TO]" % sys.argv[0]
    print "(DIRECTORY must be writeable, RSYNC-TO is optional location to RSYNC the file to)"
    sys.exit(1)

ctb = cointipbot.CointipBot(self_checks=False,
                            init_reddit=False,
                            init_coins=True,
                            init_db=False,
                            init_logging=False)

if not find_executable('gzip'):
    print "gzip executable not found, please install gzip"
    sys.exit(1)

if hasattr(ctb.conf.misc.backup,
           'encryptionpassphrase') and not find_executable('gpg'):
    print "encryptionpassphrase is specified but gpg executable not found, please install gpg"
    sys.exit(1)

for c in ctb.coins:
    filename = "%s/wallet_%s_%s.dat" % (
        sys.argv[1], ctb.conf.coins[c].unit,
예제 #3
0
#!/usr/bin/env python

import cointipbot
import argparse

parser = argparse.ArgumentParser()
parser.add_argument('network', help='[reddit, twitter,twitch, irc]')
args = parser.parse_args()

if __name__ == '__main__':
    if args.network.lower() == 'reddit':
        cb = cointipbot.CointipBot(init_reddit=True)
    elif args.network.lower() == 'twitter':
        cb = cointipbot.CointipBot(init_twitter=True)
    elif args.network.lower() == 'twitch':
        cb = cointipbot.CointipBot(init_twitch=True)
    elif args.network.lower() == 'irc':
        cb = cointipbot.CointipBot(init_irc=True)
    else:
        cb = cointipbot.CointipBot()
    cb.main()
예제 #4
0
import cointipbot
ctb = cointipbot.CointipBot()
ctb.main()
예제 #5
0
# Here's how to add a new coin type to CointipBot

import cointipbot, logging
from ctb import ctb_misc

logging.basicConfig()
lg = logging.getLogger('cointipbot')
lg.setLevel(logging.DEBUG)

# Make sure CointipBot instance is NOT running

# First, enable new coin in config.yml

# Then run these two commands
ctb = cointipbot.CointipBot(self_checks=False)
#ctb_misc.add_coin('dvc', ctb.db, ctb.coins)
예제 #6
0
from flask import Flask, jsonify, render_template
import json

import cointipbot, logging
from ctb import ctb_stats
from pymemcache.client import base

logging.basicConfig()
lg = logging.getLogger('cointipbot')
lg.setLevel(logging.INFO)

ctb = cointipbot.CointipBot(self_checks=False,
                            init_reddit=False,
                            init_twitch=True,
                            init_coins=False,
                            init_exchanges=False,
                            init_db=True,
                            init_logging=False)

app = Flask(__name__)


class JsonSerde(object):
    def serialize(self, key, value):
        if isinstance(value, str):
            return value.encode('utf-8'), 1
        return json.dumps(value).encode('utf-8'), 2

    def deserialize(self, key, value, flags):
        if flags == 1:
예제 #7
0
    def main(self):
        self.cb = cointipbot.CointipBot()

        self.cb.main()