Skip to content

Commit 71b2f4d

Browse files
committed
adds requirements and updates readme with installation and config info
1 parent 8e60018 commit 71b2f4d

3 files changed

Lines changed: 68 additions & 4 deletions

File tree

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
.vagrant
22
.DS_Store
33
*pyc
4+
venv

dvn_client/src/requirements.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
-e git+https://github.com/pjbull/python-client-sword2.git#egg=sword2
2+
argparse # for python 2.6
3+
lxml

readme.md

Lines changed: 64 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,67 @@
1-
This is a library for writing Python applications that make use of Dataverse Network (DVN) APIs.
1+
## Dataverse Network (DVN) API Client
22

3-
The code was originally written as a "proof of concept" at https://github.com/dvn/swordpoc/tree/master/dvn_client but the intention is to eventually publish the code on https://pypi.python.org so users can run `pip install dvn-client` to use the Python library.
3+
This is a library for writing Python applications that make use of Dataverse
4+
Network (DVN) APIs. The code started as a "proof of concept" in the
5+
[dvn/swordpoc](https://github.com/dvn/swordpoc) repo and the intent is to
6+
publish the python client on https://pypi.python.org.
47

5-
For now https://github.com/dvn/swordpoc/blob/master/dvn_client/README.md has some tips but they should be incorporated into this repo.
8+
The proof of concept
9+
[README.md](https://github.com/dvn/swordpoc/blob/master/dvn_client/README.md)
10+
has some tips that have not been incorporated in to this readme yet.
11+
12+
We have been trying to target Python 2.6 because that's the version that ships
13+
with the latest version (6) of Red Hat Enterprise Linux (RHEL) and CentOS. For
14+
testing backward compatibility with Python 2.6, this repo includes a Vagrant
15+
environment. Please note that before you run `vagrant up` you'll need to run
16+
`git submodule init` and `git submodule update` once after cloning this repo.
17+
18+
## Installation
19+
20+
You will need:
21+
22+
* Python 2.6+
23+
* [pip](http://www.pip-installer.org/en/latest/)
24+
* gcc compiler (For OSX you will need xcode + command line tools, or [standalone install](https://github.com/kennethreitz/osx-gcc-installer#readme))
25+
* Dataverse account
26+
27+
Once you have satisfied the above requirements, try the following commands.
28+
29+
$ git clone https://github.com/IQSS/dvn-client-python.git
30+
$ cd dvn-client-python
31+
$ virtualenv venv
32+
$ source venv/bin/activate
33+
$ pip install -r dvn_client/src/requirements.txt
34+
35+
You may wish to manage virtualenvs using [virtualenvwrapper](http://virtualenvwrapper.readthedocs.org/en/latest/) instead.
36+
37+
## Configuration
38+
39+
You need a config.py file to run. Copy `dvn-client-python/dvn-client/src/config.py-dist`
40+
to your own config.py and fill out the config elements as appropriate.
41+
42+
```python
43+
44+
DEFAULT_USERNAME = ""
45+
DEFAULT_PASSWORD = ""
46+
DEFAULT_HOST = ""
47+
DEFAULT_CERT = "../resources/dvn-build.hmdc.harvard.edu" #see below for info on the cert
48+
49+
```
50+
51+
## Installation Test
52+
53+
* Navigate to `dvn-client-python/dvn-client/src/`
54+
* Run the client `python dvn_client.py --config config.py --runTests tests.py`
55+
* To run the tests, run `python dvn_test.py` (for more options see [unittest](http://docs.python.org/2/library/unittest.html#assert-methods))
56+
57+
## PEM Certificate (optional)
58+
59+
If you are using a self-signed certificate, you may see an SSL error when you
60+
try to hit the server. In that case, follow these instructions.
61+
62+
1. Open private/incognito window (in case you have already added a security exception) in FireFox (instructions will be slightly different for other browsers)
63+
2. Go to: https://{SERVER}/dvn/api/data-deposit/swordv2/service-document
64+
3. Add Exception > View > Details > Export
65+
4. Save the PEM to the “resources” folder of the dvn\_client project
66+
5. When calling `Dataverse.connect()` or `Dataverse()` constructor, pass a path to this file as `cert=[PATH_TO_CERTIFICATE]`
667

7-
We have been trying to target Python 2.6 because that's the version that ships with the latest version (6) of Red Hat Enterprise Linux (RHEL) and CentOS. For testing backward compatibility with Python 2.6, this repo includes a Vagrant environment. Please note that before you run `vagrant up` you'll need to run `git submodule init` and `git submodule update` once after cloning this repo.

0 commit comments

Comments
 (0)