Skip to content

djbrooke/pyDataverse

 
 

Repository files navigation

Build Status Coverage Status

pyDataverse

A Python wrapper to work with the Dataverse API. It allows to create, update and remove Dataverses, Datasets and Datafiles via Dataverse's native API. The module is developed by Stefan Kasberger for AUSSDA - The Austrian Social Science Data Archive. Thanks to the developers of dataverse-client-python, from which the project got inspired.

Features

  • Python 2 and 3 (>=2.7)
  • Open Source (MIT)
  • Object-oriented programming approach
  • Many different Dataverse Api Requests (based on GET, POST (Curl) and DELETE)
  • Custom exceptions
  • Tests with pytest, Travis CI and tox.
  • Documentation with sphinx.

Copyright

  • Code: GitHub
  • Documentation: License: CC BY 4.0

INSTALL

virtualenv --python=/usr/bin/python3 venv
source venv/bin/activate
pip install -r requirements.txt

USE

Connect to API

from pyDataverse.api import Api
base_url = 'http://demo.dataverse.org'
api = Api(base_url)

Get dataverse

dv = 'ecastro'  # dataverse alias or id
resp = api.get_dataverse(dv)
print(resp.json())

Get dataset

identifier = 'doi:10.5072/FK2/U6AEZM' # doi of the dataset
resp = api.get_dataset(identifier)

Get datafile

file_id = '32' # file id of the datafile
resp = api.get_datafile(file_id)
resp.content

DEVELOPMENT

Testing

pytest

Documentation

Use Sphinx to create class and function documentation out of the doc-strings.

sphinx-build -b html docs/source docs/build/html
sphinx-apidoc -f -o docs/source ..
make html

CONTRIBUTE

In the spirit of free software, everyone is encouraged to help improve this project.

Here are some ways you can contribute:

  • by reporting bugs
  • by suggesting new features
  • by translating to a new language
  • by writing or editing documentation
  • by writing code (no pull request is too small: fix typos in the user interface, add code comments, clean up inconsistent whitespace)
  • by refactoring code or adding new features (please get in touch with us before you do, so we can syncronize the efforts and prevent misunderstandings)
  • by closing issues
  • by reviewing pull requests

When you are ready, submit a pull request.

Submitting an Issue

We use the GitHub issue tracker to track bugs and features. Before submitting a bug report or feature request, check to make sure it hasn't already been submitted. When submitting a bug report, please try to provide a screenshot that demonstrates the problem.

About

Dataverse API wrapper in Python.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 100.0%