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'
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'
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