def data(request):

    result = {}
    if request.method == 'GET':
        template = {'token':request.GET['bearer_token']}
        return HttpResponse("File not found", status=404)
    pds = None
    #scope = AccessRange.objects.get(key="funf_write")
    authorization = PDSAuthorization("funf_write", audit_enabled=False)
    if (not authorization.is_authorized(request)):
        return HttpResponse("Unauthorized", status=401)

    scope = 'funf_write'
    token = request.GET['bearer_token']
    datastore_owner_uuid = request.GET["datastore_owner__uuid"]
    datastore_owner, ds_owner_created = Profile.objects.get_or_create(uuid = datastore_owner_uuid)
    print "Creating IDS for %s" % datastore_owner_uuid
    #internalDataStore = getInternalDataStore(datastore_owner, "Living Lab", "Social Health Tracker", "Activity", token)
    internalDataStore = getInternalDataStore(datastore_owner, "Living Lab", "Social Health Tracker", token)
    #collection = connection[datastore_owner.getDBName()]["funf"]
    funf_password = "changeme"
    key = decrypt.key_from_password(str(funf_password))
    print "PDS: set_funf_data on uuid: %s" % datastore_owner_uuid

    for filename, file in request.FILES.items():
        try:
            try:
                file_path = upload_dir + file.name
                write_file(str(file_path), file)
            except Exception as ex:
                print "failed to write file to "+file_path+".  Please make sure you have write permission to the directory set in settings.SERVER_UPLOAD_DIR"
            dbdecrypt.decrypt_if_not_db_file(file_path, key)
            con = sqlite3.connect(file_path)
            cur = con.cursor()
            cur.execute("select name, value from data")
            inserted = []
            for row in cur:
                name = convert_string(row[0])
                json_insert = clean_keys(json.JSONDecoder().decode(convert_string(row[1])))
                #print json_insert$
                # Insert into PDS$
                pds_data= {}
                pds_data['time']=json_insert.get('timestamp')
                pds_data['value']=json_insert
                pds_data['key']=name
                insert_pds(internalDataStore, token, pds_data)
                inserted.append(convert_string(json_insert)+'\n')
            result = {'success': True, 'rows_inserted': len(inserted)}
            print "Inserted %s rows" % len(inserted)
        except Exception as e:
            print "Exception from funf_connector on pds:"
            print "%s"%e
            result = {'success':False, 'error_message':e.message}
        finally:
            response_dict = {"status":"success"}
    return HttpResponse(json.dumps(result), content_type='application/json')
Get clusterhost state dict.
dataset/ETHPy150Open HumanDynamics/openPDS/openpds/connectors/funf/views.py/data--crossover with--dataset/ETHPy150Open openstack/compass-core/compass/db/models.py/ClusterHost.state_dict