예제 #1
0
def get_core_auth():
    c = __get_or_load_config()
    configured_auth_token = c.get("core_auth_token", "False")
    if configured_auth_token.lower() != "false":
        return c.get("core_auth_token")
    DEFAULT_CONFIG_FILE = os.environ.get("BLOCKSTACK_CLIENT_CONFIG",
                                         "~/.ysi/client.ini")
    config_file = os.path.expanduser(c.get("core_config", DEFAULT_CONFIG_FILE))
    auth = ysi_client_config.get_config(config_file)['api_password']
    assert auth
    return auth
예제 #2
0
    # hack around absolute paths
    current_dir = os.path.abspath(os.path.dirname(__file__))
    sys.path.insert(0, current_dir)

    current_dir = os.path.abspath(os.path.join(os.path.dirname(__file__),
                                               ".."))
    sys.path.insert(0, current_dir)

    from ysi_client.storage import parse_mutable_data, serialize_mutable_data
    from ysi_client.config import log, get_config

    CONFIG_PATH = os.environ.get('BLOCKSTACK_CONFIG_PATH', None)
    assert CONFIG_PATH, "Missing BLOCKSTACK_CONFIG_PATH from environment"

    conf = get_config(CONFIG_PATH)
    print json.dumps(conf, indent=4, sort_keys=True)

    pk = keylib.ECPrivateKey()
    data_privkey = pk.to_hex()
    data_pubkey = pk.public_key().to_hex()

    test_data = [
        ["my_first_datum", "hello world", 1, "unused", None],
        ["/my/second/datum", "hello world 2", 2, "unused", None],
        [
            "user\"_profile", '{"name":{"formatted":"judecn"},"v":"2"}', 3,
            "unused", None
        ],
        ["empty_string", "", 4, "unused", None],
    ]
예제 #3
0
import binascii
import traceback
import jsontokens

from test import test_support
from binascii import hexlify

from ysi_client import schemas
import ysi_client.storage
import ysi_client.config as ysi_config
import ysi_client.config as ysi_constants
import ysi_client.keys

BASE_URL = 'http://localhost:5000'

API_PASSWORD = ysi_config.get_config(ysi_constants.CONFIG_PATH).get(
    'api_password', None)

DEFAULT_WALLET_ADDRESS = "1QJQxDas5JhdiXhEbNS14iNjr8auFT96GP"


class FakeResponseObj:
    def __init__(self):
        self.status_code = 600
        self.data = ""


class ForwardingClient:
    def __init__(self, base_url):
        self.base_url = base_url

    def get(self, endpoint, headers={}):