Please be noted that latest version of pyDataverse 0.3.x is not backwards compatible. We stick to 0.2.1.
Install all the required packets
pip install -r requirements.txtcp sample-dvconfig.py dvconfig.pyAdjust the content of the newly created dvconfig.py
base_url = 'https://dataverse-url-without-trailing-back-slash.com'
api_token = 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxx'
output_folder = 'output'base_urlis the link of your Dataverse installation.api_tokenis the super user token of your Dataverse user.output_folderis the local folder on your computer within the working directory
Adjust the script according to your own need
...
if __name__ == '__main__':
'''export all the datasets from specific dataverse to default format json_ld'''
# export_datasets_dataverse('liss_dc')
'''export single dataset to default format json_ld'''
# export_dataset('oai:11.32332/aabb-ccdd-eff')
'''export list of datasets to default format json_ld'''
# export_datasets(['oai:11.32332/aabb-ccdd-eff1', 'oai:11.32333/aabb-ccdd-eff2', 'oai:11.32334/aabb-ccdd-eff3'...])uncomment ONE of the statements below according to your needs
export_datasets_dataverse('dataverse_name')- this statement get all the datasets from the given dataverse.export_dataset('oai:11.32332/aabb-ccdd-eff')- export only one dataset, given the PIDexport_datasets(['oai:11.32332/aabb-ccdd-eff1', 'oai:11.32333/aabb-ccdd-eff2', 'oai:11.32334/aabb-ccdd-eff3'...])- export datasets by list of PIDs
Available formats listed below
ExportFormats.json_ld
ExportFormats.ddi
ExportFormats.oai_dc
ExportFormats.Datacite
ExportFormats.dataverse_json
ExportFormats.dcterms
ExportFormats.oai_datacite
ExportFormats.oai_ddi
ExportFormats.OAI_OREFormat can be given as the second parameter with any of the 3 statement
For example,
export_datasets_dataverse('dataverse_name', ExportFormat.ddi)export_dataset('oai:11.32332/aabb-ccdd-eff', ExportFormat.oai_dc)export_datasets(['oai:11.32332/aabb-ccdd-eff1', 'oai:11.32333/aabb-ccdd-eff2', 'oai:11.32334/aabb-ccdd-eff3'], ExportFormat.OAI_ORE)