예제 #1
0
def profile_log(function):
    import blockstack_client.config as blockstack_config
    log = blockstack_config.get_logger()

    import cProfile, StringIO, pstats
    def wrapper(*a, **kw):
        pr = cProfile.Profile()
        pr.enable()
        out = function(*a, **kw)
        pr.disable()
        s = StringIO.StringIO()
        sortby = 'time'
        ps = pstats.Stats(pr, stream=s).sort_stats(sortby)
        ps.print_stats(10)
        log.debug(s.getvalue())
        return out
    return wrapper
예제 #2
0
from .config import SEARCH_NODE_URL, SEARCH_API_ENDPOINT_ENABLED

# hack around absolute paths
current_dir = os.path.abspath(os.path.dirname(__file__))
parent_dir = os.path.abspath(current_dir + "/../")

sys.path.insert(0, parent_dir)

import blockstack_client.config as blockstack_config
import blockstack_client.config as blockstack_constants

from blockstack_client.rpc import local_api_connect, local_api_start, local_api_action
from blockstack_client.wallet import make_wallet
from blockstack_client.proxy import getinfo

log = blockstack_config.get_logger()
"""
# starting internal API logic should go somewhere else
#local_api_start(password='******')

#Check first if API daemon is running
status = local_api_action('status')

if(status):
    log.debug("API daemon is running")
else:
    log.debug("Start API daemon first")
    exit(0)
"""

# Import app
from .config import SEARCH_NODE_URL, SEARCH_API_ENDPOINT_ENABLED

# hack around absolute paths
current_dir = os.path.abspath(os.path.dirname(__file__))
parent_dir = os.path.abspath(current_dir + "/../")

sys.path.insert(0, parent_dir)

import blockstack_client.config as blockstack_config
import blockstack_client.config as blockstack_constants

from blockstack_client.rpc import local_api_connect, local_api_start, local_api_action
from blockstack_client.wallet import make_wallet
from blockstack_client.proxy import getinfo

log = blockstack_config.get_logger()

"""
# starting internal API logic should go somewhere else
#local_api_start(password='******')

#Check first if API daemon is running
status = local_api_action('status')

if(status):
    log.debug("API daemon is running")
else:
    log.debug("Start API daemon first")
    exit(0)
"""
예제 #4
0
import traceback
requests.packages.urllib3.disable_warnings()

import logging
logging.disable(logging.CRITICAL)

from blockstack_client import config
from blockstack_client.client import session
from blockstack_client.constants import WALLET_FILENAME, set_secret, serialize_secrets, write_secrets, load_secrets, CONFIG_PATH
from blockstack_client.config import CONFIG_PATH, VERSION, client_uuid_path, get_or_set_uuid
from blockstack_client.method_parser import parse_methods, build_method_subparsers

from .wallet import inspect_wallet
from utils import exit_with_error, print_result

log = config.get_logger()


# a less-verbose argument parser
class BlockstackArgumentParser(argparse.ArgumentParser):
    def print_usage(self, *args, **kw):
        pass

    def exit(self, *args, **kw):
        raise SystemExit()


def get_methods(prefix, module):
    """
    Get the built-in CLI methods
    """
예제 #5
0
from blockstack_client.client import session
from blockstack_client.config import WALLET_PATH, WALLET_PASSWORD_LENGTH, CONFIG_PATH, VERSION
from blockstack_client.method_parser import parse_methods, build_method_subparsers

import blockstack_client.actions as builtin_methods

from blockstack_profiles import resolve_zone_file_to_profile
from blockstack_profiles import is_profile_in_legacy_format

from pybitcoin import is_b58check_address

from binascii import hexlify
from wallet import *
from utils import exit_with_error, pretty_dump, print_result

log = config.get_logger()

def get_methods(prefix, module):
    """
    Get the built-in CLI methods
    """
    methods = []
    for attr in dir(module):
        if attr.startswith(prefix):
            method = getattr(module, attr)
            if callable(method) or hasattr(method, '__call__'):
                methods.append( method )

    return methods