Exemple #1
0
    rq = Redis()

    b = BroadcastToRedis("localhost", "silochanges")
    b.creation(silo_name, item_id)

    #    line = rq.spop("{\"_timestamp\": \"2013-05-16T18:03:24.125059\", \"type\": \"c\", \"id\": \"datafinder_1\", \"silo\": \"DataFinder\"}")

    #    msg = json.loads(line)

    user_name = "admin"
    password = "******"
    datastore = HTTPRequest(endpointhost="10.0.1.154")
    datastore.setRequestUserPass(endpointuser=user_name, endpointpass=password)

    (resp, respdata) = datastore.doHTTP_GET(resource="/" + silo_name + "/states/" + item_id)
    # print str(respdata)
    json_data = json.loads(respdata)
    uuid = json_data["state"]["metadata"]["uuid"]

    (resp, respdata) = datastore.doHTTP_GET(resource="/" + silo_name + "/datasets/" + item_id + "/manifest.rdf")
    # print respdata
    text_file = open("sample_redis_manifest.rdf", "w")
    text_file.write(respdata)
    text_file.close()
    graph = rdflib.Graph()
    try:
        with open("sample_redis_manifest.rdf", "r") as f:
            graph.parse(f, base="sample_redis_manifest.rdf")
    except IOError, e:
        pass
Exemple #2
0
            else:
                document[field].append(unicode(o).encode("utf-8"))
        else:
            document['text'].append(unicode(o).encode("utf-8"))
    document = dict(document)
    return document

if __name__ == "__main__":
 
    solrurl = "http://localhost:8081/solr"
    user_name = 'admin' 
    password = '******'
    datastore = HTTPRequest(endpointhost='10.0.1.154')       
    datastore.setRequestUserPass(endpointuser=user_name, endpointpass=password) 
    
    (resp,silostr) = datastore.doHTTP_GET(resource="/silos" , expect_type="application/JSON")
    silos = ast.literal_eval(silostr)
    print "silos = " + str(silos)
    silos=['DataFinder']
    for silo in silos:
        print "Currently addressing silo = " + silo
        (resp,datasetsstr) = datastore.doHTTP_GET(resource="/" + silo + "/datasets", expect_type="application/JSON")
        
        datasets = ast.literal_eval(datasetsstr)
        
        for dataset in datasets:
            print "dataset =  " + dataset
            item_id = dataset
            (resp,respdata) = datastore.doHTTP_GET(resource="/" + silo +"/states/" + item_id )
            #print "/" + silo +"/states/" + item_id
            #print str(respdata)