Exemple #1
0
def get_data(url):
    """
    Test urllib2 opener
    """
    handler = blockstack_client.BlockstackHandler(full_response=True)
    opener = urllib2.build_opener(handler)
    dat = opener.open(url)
    return json.loads(dat.read())
Exemple #2
0
def get_data(url):
    """
    Test urllib2 opener
    """
    handler = blockstack_client.BlockstackHandler(full_response=True)
    opener = urllib2.build_opener(handler)
    dat = opener.open(url)
    res1 = json.loads(dat.read())

    res2 = testlib.blockstack_cli_get_data(url)
    if 'error' in res2:
        return res2

    if res1 != res2:
        print json.dumps(res1, indent=4, sort_keys=True)
        print json.dumps(res2, indent=4, sort_keys=True)
        return {'error': 'mismatched data'}

    return res2