示例#1
0
def metadata():
    urllib.urlretrieve(metadata_csv, 'data/series-metadata.csv')
    print 'Retrieved latest data'

    client = DataStoreClient(metadata_url)
    client.delete()
    print 'Delete done'

    client.upload('data/series-metadata.csv')
    print 'uploaded'
示例#2
0
def data():
    # get the latest
    urllib.urlretrieve(series_data_csv, 'data/series-data.csv')
    print 'Retrieved latest data'

    client = DataStoreClient(data_url)
    client.delete()
    print 'Delete done'

    #mapping = json.load(open('data/mapping.json'))
    #client.mapping_update(mapping)

    client.upload('data/series-data.csv')
    print 'uploaded'
示例#3
0
def transfer_data(label, csv_url, datahub_id):
    # download
    print "Getting CSV data for " + label + "..."
    urllib.urlretrieve(csv_url, 'yourtopia/static/data/' + label + '.csv')
    print 'Retrieved latest data for ' + label
    # empty target repository
    datahub_url = 'http://thedatahub.org/api/data/' + datahub_id
    client = DataStoreClient(datahub_url)
    try:
        client.delete()
        print 'Emptied repository for ' + label
    except HTTPError:
        print 'Repository for ' + label + ' was empty'

    #mapping = json.load(open('data/mapping.json'))
    #client.mapping_update(mapping)

    print 'Start uploading data for ' + label + '...'
    client.upload('yourtopia/static/data/' + label + '.csv')
    print 'Finished uploading data for ' + label